Is it possible to use option_groups_from_collection_for_select with include_blank on rails?

I want to use my rails a script helper as follows:

select_tag(:article_id, option_groups_from_collection_for_select( @article, :categories, :name, :id, :name, :include_blank => "Select one category"))

but nothing happens in my script. How can I use option_groups_from_colletion_for_select using the include_blank method?

+3
source share
1 answer

include_blank is an option for the selection assistant, so you were almost there:

select_tag(:article_id, option_groups_from_collection_for_select( @article, :categories, :name, :id, :name), {:include_blank => "Select one category"})
+2
source

Source: https://habr.com/ru/post/1753015/


All Articles