Modify select_year()


#1

Hi -

Does anyone know how to add a selection to this helper:

select_year(date, options = {}, html_options = {})

I would like to precede it with ‘Select a year’ just as I would if I
were using .unshift.

Right now the control is fully populated from start to end year.

Any ideas appreciated - figured best to ask before having to write a
custom helper.

Thanks!


#2

If you’re running Rails 2.3 then select_year accepts the :prompt
option, so…

select_year(date, :prompt => ‘Select a year’)

…would work. If you’re on an older version of Rails, you’ll need to
do some DIY :slight_smile:


#3

Thanks - I should have caught that.

Best,
NB