Hi I am playing around with the imports scripts and I want to create a drop down user field. The ning script has an example of creating a text field which I have working, and I am able to add a dropdown w/ no options, but when I change the type to drop down and add an options attribute like so
@interests_field = UserField.find_by_name("My interests5") unless @interests_field @interests_field = UserField.create(name: "My interests5", description: "Do you like stuff5?", field_type: "dropdown", editable: true, required: true, show_on_profile: true, show_on_user_card: true, options: ['a','b', 'c'] ) end
I get this error:
.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/attribute_assignment.rb:59:in `rescue in _assign_attribute’: unknown attribute ‘options’ for UserField. (ActiveRecord::UnknownAttributeError)
I am new to ruby and discourse but I think the relevant code is in
There is also a file
which suggests that options should be passable somehow?
Thanks to anyone who can shed light on this mystery.
Specifically how can I add options programmatically when creating a userfield in a ruby script situation.