Using Rails 4.1.5 and simple_form, 3.0.2 and Postgresql, I declared an array, rsvp_options in the function table. After stAndres answer I did the following
<%= simple_form_for @function do |f| %> <%= f.input_field :rsvp_options, multiple: true %> <%= f.input_field :rsvp_options, multiple: true %> <%= f.button :submit , class: 'btn btn-primary'%> <% end %>
If @ function.rsvp_options is initialized using ['test1', 'test2'], then a simple form displays two fields, but both have {test2, test2} in them. If @ function.rsvp_options is initialized with [], then both fields have {} in them. In addition, there are no shortcuts for boxes.
In addition, simple_form actually works, in the sense that if I put text in each field, then the rsvp_options variable is updated properly. In other words, the only problem is the display of information, rather than processing it in the parameters.
So, how can I use simpleform to correctly display the data of an array, and also give it a label?
ruby-on-rails simple-form
Obromios Dec 10 '14 at 22:30 2014-12-10 22:30
source share