Help with a collection

I’m using the following code as a filter for a comprehensive list of
sales per month and year:

Month: <%= select_tag (:month, options_for_select([[“January”, 1], [“February”, 2], [“March”, 3], [“April”, 4], [“May”, 5], [“June”, 6], [“July”, 7], [“August”, 8], [“September”, 9], [“October”, 10], [“November”, 11], [“December”, 12]])) %>

Year: <%= select_tag (:year, options_for_select([“2005”, “2006”, “2007”, “2008”, “2009”, “2010”, “2011”, “2012” ])) %>

What I want, is to return the string value of the month. In other words,
I want this:

Sales for 8 2009

To become this:

Sales for August 2009

Date::MONTHNAMES[8]
=> “August”

Sharagoz – wrote:

Date::MONTHNAMES[8]
=> “August”

Works a treat - thank you.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs