tis*_*was 12 ruby select ruby-on-rails class
我看过如何在Rails中为collection_select设置HTML选项?而且我确定我错过了一些明显的东西,但我无法让它发挥作用.
我的选择目前看起来像:
<%= f.collection_select :broadcast_id, broadcasts, :id, :to_s,
:include_blank => 'Broadcast on...' %>
Run Code Online (Sandbox Code Playgroud)
我尝试过包括:class =>'prevent_collapse',什么都不做,以及{:class =>'prevent_collapse'},这给了我一个错误.
如果有人能指出如何做到这一点,我将非常感激!
fl0*_*00r 22
collection_select(object, method, collection, value_method, text_method, options = {}, html_options = {})
=>
f.collection_select :broadcast_id, broadcasts, :id, :to_s,
{:include_blank => 'Broadcast on...'}, {:class => 'prevent_collapse'}
Run Code Online (Sandbox Code Playgroud)
你有什么错误?
广播项目有:to_s方法吗?正如我所想,它将返回类名.