For the code given below I wanted to keep the select box selected with the value that is passed.
But this doesn’t work:
@yrs =[2011,2010,2009,2008] &
Remove the :selected=> part.
:selected=>
Syntax:
options_for_select(@options, @selected_options)
Usage:
options_for_select(1..5, 3) # creates a range 1..5 , with 3 as selected by default