开发者

Can I use option_groups_from_collection_for_select with include_blank on rails?

开发者 https://www.devze.com 2023-01-05 11:11 出处:网络
I want use on my rails helper a script as follow: select_tag(:article_id, option_groups_from_collection_for_select( @article, :categories, :name, :id, :name, :include_blank => \"Select one categor

I want use on my rails helper a script as follow:

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

but in my script, nothing happens. How can I use option_groups_from_colletion_for_select with include开发者_JAVA百科_blank method?


include_blank is an option for the select helper, 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"})
0

精彩评论

暂无评论...
验证码 换一张
取 消