<%= collection_select(:catgory, :id, @categories, :id, :title, {}, data: { behavior: 'category_dropdown' }) %>
In the above code I need to pass a parameter to the title method. Is there any way to do this with collection_select?
<%= collection_select(:catgory, :id, @categories, :id, (:title, @program), {}, data: { behavior: 'category_dropdown' }) %>
Edit:
Looking at the internals for collection_select the text_method. It is eventually passed to a .send method which should allow for element.send(:title, @program). However, I think the issue why I still can’t pass the param is that collection select is reading (:title, @program) as two params instead of one.
Use
selectinstead:Should be working.