在Rails(HAML)中为select_year助手添加css类

duy*_*hoa 2 ruby-on-rails-3 ruby-on-rails-3.2

我想写这段代码

<select name="date[birth]" id="date_birth" class = "span1">
      <option value="2011">2011</option>
      <option value="2012" selected="selected">2012</option>
      <option value="2013">2013</option>
      </select>
Run Code Online (Sandbox Code Playgroud)

在Rails中,它有select_year帮助器,我只是写

= select_year(Date.today, :field_name => "birth", :start_year => 2011, :end_year => 2013)
Run Code Online (Sandbox Code Playgroud)

我尝试通过属性将css类添加到此:class => "span1",但它不起作用!请帮帮我,谢谢

aro*_*ero 9

= select_year(Date.today, {:field_name => "birth", :start_year => 2011, :end_year => 2013}, {:class => "span1"})
Run Code Online (Sandbox Code Playgroud)