我想在我的 Rails 助手上使用如下脚本:
select_tag(:article_id, option_groups_from_collection_for_select( @article, :categories, :name, :id, :name, :include_blank => "Select one category"))
但在我的脚本中,没有任何反应。如何将 option_groups_from_colletion_for_select 与 include_blank 方法一起使用?
最佳答案
include_blank
是 select helper 的一个选项,所以你就快到了:
select_tag(:article_id, option_groups_from_collection_for_select( @article, :categories, :name, :id, :name), {:include_blank => "Select one category"})
关于ruby-on-rails - 我可以在 rails 上使用 option_groups_from_collection_for_select 和 include_blank 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3173411/