Manipulating custom user fields from the Rails console

Also something like

UserCustomField.create(user_id: 1, name: "user_field_4",value: "Oops")

Oh, but if that already has a value, it’ll add a second one! So you might

 ucf=UserCustomField.find_by(user_id: name: 'user_field_4')

and then you’d need to either update it or create a new one.

But if you do create multiple ones, the UX will show them comma-separated, and if they are edited via the UX when they get saved, they get saved back to a single value.

You can have a look at them with

  UserCustomField.all

Or

UserCustomField.where(name: x)

That’s by memory on my phone so your mileage may vary.