Marco
Marco

Reputation: 10823

Rails 3.1 - Options_for_select values

my view should be make the following mysql query:

SELECT `egress_transport_documents`.* FROM `egress_transport_documents`  WHERE month(date) = 4

and in same view I've a drop-down menu to select witch month of the year you want choose. My issue is that, Mysql accepts only numerically values for months(1..12) while I want that in dropdown menu, user can choose between string values such as 'January','February'.. and not between '1','2'....'12' . in witch way can I do?

Upvotes: 0

Views: 132

Answers (1)

sailor
sailor

Reputation: 8044

Did you consider using select_month helper:

http://api.rubyonrails.org/classes/ActionView/Helpers/DateHelper.html#method-i-select_month

Upvotes: 1

Related Questions