Manipulating custom user fields from the Rails console

I think this format changes only the custom field in question. I’ve tested it briefly, and it seemed to do the trick. :+1:

users=User.where("users.created_at <= '2019-09-13'::timestamp")
users.each do |u|
  u.custom_fields["user_field_16"] = "Nil"
  u.save
end

Though if you wanted the field to be NULL rather than say ‘Nil’ you could try this instead:

users=User.where("users.created_at <= '2019-09-13'::timestamp")
users.each do |u|
  u.custom_fields["user_field_16"] = NIL
  u.save
end