Jump to content

The ultimate community for Ruby on Rails developers.


Photo

Why won't my multiple => true work in my collection_select?


  • Please log in to reply
3 replies to this topic

#1 jschrock1

jschrock1

    Dispatcher

  • Members
  • 48 posts
  • LocationIndianapolis

Posted 20 November 2013 - 09:40 PM

I have the following coded as I've seen many examples, however it does not work, when viewing page source, rails did not put in the multiple html tags..

 

<%= collection_select(:category, :skill_id, @job_sub_categories, :id, :name, {:multiple => true})  %>

 

I know im missing something simple, but stuck on this for a while...



#2 Kevin

Kevin

    Signalman

  • Members
  • 21 posts

Posted 21 November 2013 - 08:46 AM

what are you trying to achieve ? a multiple select box ?

 

assuming yes, here's another example , just match it on your own:

<%= collection_select(:ingredient, :supplier_ids, 
              Supplier.all(:order=>"name ASC"), 
              :id, :name, {:selected => @ingredient.supplier_ids, :include_blank => true}, {:multiple => true}) %>



#3 Kevin

Kevin

    Signalman

  • Members
  • 21 posts

Posted 21 November 2013 - 08:49 AM

therefore, yours should be like :



<%= collection_select(:category, :skill_id, @job_sub_categories, :id, :name,{}. {:multiple => true})  %>

let me know if it's working



#4 jschrock1

jschrock1

    Dispatcher

  • Members
  • 48 posts
  • LocationIndianapolis

Posted 21 November 2013 - 03:19 PM

therefore, yours should be like :



<%= collection_select(:category, :skill_id, @job_sub_categories, :id, :name,{}. {:multiple => true})  %>

let me know if it's working

YES!  nice, that works, so the {}, is required, uggg I can't tell you how much time I spent on that!  thank you!


  • Kevin likes this




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users