# Saving edits on user preferences page with required custom fields is unclear

**URL:** <https://meta.discourse.org/t/saving-edits-on-user-preferences-page-with-required-custom-fields-is-unclear/51090>\
**Category:** UX\
**Created:** [2016 年10 月 4 日 20:15 UTC](https://meta.discourse.org/t/saving-edits-on-user-preferences-page-with-required-custom-fields-is-unclear/51090 "2016-10-04T20:15:41Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

作者： ![shadowbrush](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/shadowbrush/32/121502_2.png) [@shadowbrush](https://meta.discourse.org/u/shadowbrush)\
发布日期： [2016 年10 月 5 日 00:58 UTC](https://meta.discourse.org/t/saving-edits-on-user-preferences-page-with-required-custom-fields-is-unclear/51090/6 "2016-10-05T00:58:24Z")

</div>

I gave all existing users a value for the custom field:

```
users = User.where('NOT EXISTS(
                     SELECT 1
                     FROM user_custom_fields ucf
                     WHERE
                       ucf.user_id = users.id AND
                       ucf.name = ?
                  )', 'user_field_1')

users.each do |u|
  u.custom_fields['user_field_1'] = 'invited'
  u.save!
end

```

---

_[View the full topic](https://meta.discourse.org/t/saving-edits-on-user-preferences-page-with-required-custom-fields-is-unclear/51090)._
