# Modify select\_year()

**URL:** <https://www.ruby-forum.com/t/modify-select-year/162593>\
**Category:** Rails\
**Created:** [March 11, 2009, 6:03pm UTC](https://www.ruby-forum.com/t/modify-select-year/162593 "2009-03-11T18:03:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![northband](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ecae2f/32.png) [@northband](https://www.ruby-forum.com/u/northband)\
**Post date:** [March 11, 2009, 6:03pm UTC](https://www.ruby-forum.com/t/modify-select-year/162593/1 "2009-03-11T18:03:27Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![northband](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ecae2f/32.png) [@northband](https://www.ruby-forum.com/u/northband)\
**Post date:** [March 12, 2009, 10:02am UTC](https://www.ruby-forum.com/t/modify-select-year/162593/2 "2009-03-12T10:02:58Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![northband](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ecae2f/32.png) [@northband](https://www.ruby-forum.com/u/northband)\
**Post date:** [March 12, 2009, 3:17pm UTC](https://www.ruby-forum.com/t/modify-select-year/162593/3 "2009-03-12T15:17:43Z")

</div>

Thanks - I should have caught that.

Best,  
NB
