Last active
August 29, 2015 14:06
-
-
Save maier-stefan/9aaa92bf0cfce304b254 to your computer and use it in GitHub Desktop.
Collection Select
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I have a multiselect with checkboxes: | |
<%= f.label :Category, :class => 'control-label' %> | |
<% Category.all.each do |category| -%> | |
<div> | |
<%= check_box_tag :category_ids, category.id, @job.categories.include?(category), :name => 'job[category_ids][]' %> | |
<%= label_tag :category_ids, category.name %> | |
</div> | |
<% end %> | |
I want to build a multiple collection Select like this | |
<div class="from-goup"> | |
<%= f.label :category, :class => 'control-label' %><div class="controls"> | |
<%= f.collection_select :category_ids, Category.all, :id, :name, { :selected => @job.categories }, { :multiple => true, :name => 'job[category_ids][]' }, :class => 'form-control' %> | |
</div> | |
</div> | |
Error: wrong number of arguments |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment