-6ren">
gpt4 book ai didi

ruby-on-rails - Rails SelectTag include_blank 不工作

转载 作者:数据小太阳 更新时间:2023-10-29 08:40:17 25 4
gpt4 key购买 nike

我正在使用 select_tag 并使用它从数据库中填充它。

<%= select_tag 'project', options_from_collection_for_select(@issue_statuses,"id", "name"), :include_blank  => 'Select' , html_options = { :onblur => "myblur(this);", :onChange=> "submit_selected(this);", :style=> "visibility:visible;" } %>

但是在包含“:include_blank”时出现以下错误:

compile error
/home/hitesh/redmine-1.3.0-1/apps/redmine/vendor/plugins/redmine_polls/app/views/questions/index.html.erb:42: syntax error, unexpected ')', expecting tASSOC
...le=> "visibility:visible;" } ).to_s); @output_buffer.concat ...
^

如何在上面的代码中包含空白或提示值。

谢谢。

最佳答案

在其中包含 :include_blank 调用:{}

<%= select_tag 'project', options_from_collection_for_select([],"id", "name"), {:include_blank  => 'Select', :onblur => "myblur(this);", :onChange=> "submit_selected(this);", :style=> "visibility:visible;" } %>

关于ruby-on-rails - Rails SelectTag include_blank 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8984822/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com