Forum: Ruby on Rails Modify select_year()

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
northband (Guest)
on 2009-03-11 19:03
(Received via mailing list)
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.

rob-twf (Guest)
on 2009-03-12 11:02
(Received via mailing list)
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 :)
northband_101 (Guest)
on 2009-03-12 16:17
(Received via mailing list)
Thanks - I should have caught that.

This topic is locked and can not be replied to.