tags:

views:

203

answers:

1

Wondering how to do this.

I have a month helper and want to render a list of each month.

If you click on the month it would then pass the number value . I want to produce a list like this

Choose a month
January - February - March - April - May.....

That are links. My helper looks like this.

 MONTHLIST =  [
  [ "January", "1" ],
  [ "February", "2" ],
  [ "March", "3" ] 
  ].freeze

How do I use link_to to get the names and link be the value. i.e #3 for march.

A: 

<% monthlist.each do |month| %>

<%= link_to month[0], your_route(month[1]) %>

<% end %>

Mike Benner