A little more help with a collection

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]])) %>

I need to ensure that the collection above displays the current month
that may be in the parameters, how do I do this?

<%= select_month(Date.today) %>

(the field name will be date[month])

Sharagoz – wrote:

<%= select_month(Date.today) %>

(the field name will be date[month])

Thanks for your response. Sorry if I was unclear, I just want the form
with a collection for month and year to remember the values it has been
passed. Once I complete the form and submit, it displays the correct
records but the form itself reverts.

If you check the API you’ll find this:
options_for_select(container, selected = nil)

Supply a second parameter for the “selected” value

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