Gathering all of the above from @alex_peattie's answer, I came to the following:
<%= select_year Date.today, :start_year => Time.now.year, :end_year => Time.now.year - 95, :field_name => :grad_year, :prefix => :profile %>
As in the OP question, my case was executed in the form_for block, so f.select_year exception. But if you just use the documented option :field_name , the tag will have the identifier date_grad_year and the name date[grad_year] , which are not what Rails expects. Usage (only documented at the very top of the API) :prefix changes date to profile .
So, this is better than # @% $ ^ * & html_options hash, which, despite using rails for 5 years, I canβt get right without five attempts :-).
Oh, rails, how I love you, but at the same time, I'm glad that the qaru around us helps everyone understand your delightful features!
source share