Simple Form for has_and_belongs_to_many association

402 views
Skip to first unread message

Kevin Mullaney

unread,
May 28, 2014, 5:51:23 PM5/28/14
to plataformate...@googlegroups.com
I'm using Rails 4, simple_form and Zurb Foundation for styling.

I have a form which is now functioning correctly, but the select input for the association is awkward to use. Here is my form (I've bolded the relevant line):

<div class="content-box">
  <%= simple_form_for [:admin, @venue] do |f| %>
    <%= f.input :name %>
    <%= f.input :permalink %>
    <%= f.input :description, input_html: { cols: 100, rows: 6 }%>
    <%= f.input :address %>
    <%= f.input :city %>
    <%= f.input :phone %>
    <%= f.association :photos %> 
    <%= f.button :submit, class: 'small radius' %>
  <% end %>
</div>

This produced a select box that is one line and only shows one choice at a time. This is not very optimal for a select input where I might need to select half a dozen photos from the list. I tried adding "input_html: { size: '10' }", but that didn't work. Any ideas?

Rafael Mendonça França

unread,
May 28, 2014, 6:06:39 PM5/28/14
to PlataformaTec - SimpleForm
I think that you want is the `:multiple` option

--
You received this message because you are subscribed to the Google Groups "SimpleForm" group.
To unsubscribe from this group and stop receiving emails from it, send an email to plataformatec-simp...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kevin Mullaney

unread,
May 28, 2014, 6:49:21 PM5/28/14
to plataformate...@googlegroups.com
The :multiple is set by default for has_many associations I believe. 
To unsubscribe from this group and stop receiving emails from it, send an email to plataformatec-simpleform+unsub...@googlegroups.com.

Rafael Mendonça França

unread,
May 28, 2014, 6:56:09 PM5/28/14
to PlataformaTec - SimpleForm
Right, so I don't know why it is not working without trying to reproduce myself.
To unsubscribe from this group and stop receiving emails from it, send an email to plataformatec-simp...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages