Reputation: 16383
Using Rails 4.1.5 and simple_form, 3.0.2 and Postgresql, I have declared an array, rsvp_options in the functions table. Following 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 initalised with ['test1','test2'], then simple form displays two boxes, but both ones have {'test1','test2'} in them. If @function.rsvp_options is initialised with [], then both boxes have {} in them. Also, there is no label for the boxes.
Apart from this, simple_form actually works, in the sense that if I put text into each box, then the rsvp_options variable is updated properly. In other words, the only problem is with the display of the information, not the handling of it into params.
So, how do I use simpleform to properly display the array data and also give a label for it?
Upvotes: 2
Views: 2384
Reputation: 16383
This open issue would seem to indicate that simple_form does not support arrays at the present time.
Upvotes: 2