Rails - return an array of months for a select tag

前端 未结 10 2519
谎友^
谎友^ 2021-02-07 10:02

I\'m in an app that is on Rails 2.3.8, and need to return an array of month names and numbers to be plugged into an options_for_select statement. What I\'ve got so far is kind

10条回答
  •  孤城傲影
    2021-02-07 10:09

    Try it

    <% (1..12).each do |month|%>
      <%= link_to t('date.month_names')[month], '#' %>
    <% end %>
    

提交回复
热议问题