我需要在Rails中为collection_select设置默认宽度。我尝试了这个,但它不起作用:
<%= u.collection_select :program_id, Program.where(:status => true), :id, :name , :include_blank=> true, :class=>'foo'%>
我也尝试过:
<%= u.collection_select :program_id, Program.where(:status => true), :id, :name , :include_blank=> true, {:class=>'foo'}%>
<%= u.collection_select :program_id, Program.where(:status => true), :id, :name , :include_blank=> true, :style=>'width:50%'%>
他们没有工作,任何想法?
答案 0 :(得分:0)
最后我弄清楚了:
<%= u.collection_select :program_id, Program.where(:status => true), :id, :name , {:include_blank=> true}, {:class=>'foo'}%>
现在有效!