Forum: Ruby on Rails Modify select_year()

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
068d5aec7da6333ce34a848ed4867668?d=identicon&s=25 northband (Guest)
on 2009-03-11 18: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.

Thanks!
Feeab6a10f05f7962e314c5e43548157?d=identicon&s=25 rob-twf (Guest)
on 2009-03-12 10: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 :)
068d5aec7da6333ce34a848ed4867668?d=identicon&s=25 northband_101 (Guest)
on 2009-03-12 15:17
(Received via mailing list)
Thanks - I should have caught that.

Best,
NB
This topic is locked and can not be replied to.