2
我需要设置一个HTML类此轨道选择和我已经尝试了许多变化并没有什么设置在轨道一类选择
<%= add.select :state,
@states.map { |s| [ s.name, s.abbr ] },
:class => 'state',
:include_blank => true
%>
我需要设置一个HTML类此轨道选择和我已经尝试了许多变化并没有什么设置在轨道一类选择
<%= add.select :state,
@states.map { |s| [ s.name, s.abbr ] },
:class => 'state',
:include_blank => true
%>
我相信你options
后您html_options
应该去。另外,由于您为最后两个参数指定了两个哈希值,因此应该使用大括号来明确告诉Ruby它们是两个单独的哈希值。试试这个:
<%= add.select(:state,
@states.map { |s| [ s.name, s.abbr ] },
{ :include_blank => true },
{ :class => 'state' }
)
%>
谢谢你,因为我玩弄了一会儿 – Trace 2010-07-20 01:28:33