KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
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 of working, but not really. The reason I'm doing things this way is because the select statement needs a prompt, which you can't give options_for_select by default in 2.3.8 (at least to my knowledge). Here is what I have so far: @months = [['-', '']] (1..12).each {|m| @months << [[Date::MONTHNAMES[m], m]]} So what I'm looking to get returned are options like this: <option value="1">January</option> <option value="2">February</option> However, instead I get: <option value="January1">January1</option> <option value="February2">February2</option> What am I missing?
Tags (comma-separated)
Save Edits
Cancel