I am trying to create a collection_select with custom data settings for parameters. I know how to create parameters with custom data attributes, but when I try to add these parameters to my collection, select my code breaks, no matter what I do.
The code below works
<%= f.collection_select :tag_ids, Tag.all, :id, :name, {}, {multiple: true} %>
Then I change it and it breaks, giving an error below
<%= f.collection_select(:tag_ids, options_for_select(Tag.all.collect{|t| [t.name, t.id]}), {}, {multiple: true}) %>
undefined method `map' for #<ActiveSupport::SafeBuffer:0x00000102df6648>
I have googled and tried many variations, but I was hoping that someone could help me with this.
I know that my code does not include data attributes, but I simplified my example.
source
share