# Select helper

**URL:** <https://www.ruby-forum.com/t/select-helper/152114>\
**Category:** Rails\
**Created:** [October 30, 2008, 6:03am UTC](https://www.ruby-forum.com/t/select-helper/152114 "2008-10-30T06:03:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [October 30, 2008, 6:03am UTC](https://www.ruby-forum.com/t/select-helper/152114/1 "2008-10-30T06:03:22Z")

</div>

I am trying to figure out how to use the “select” helper in changing a  
scaffold produced “new.html.erb” file. Specifically how do I change:

Year In School: \<%= f.text\_field :year %\>

so that this shows up as a “drop down box”.

I’ve tried different variations of

\<%= f.select :year %\>

but that never works.  
Any help?

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [October 30, 2008, 6:11am UTC](https://www.ruby-forum.com/t/select-helper/152114/2 "2008-10-30T06:11:57Z")

</div>

removed\_email\_address@domain.invalid wrote:

> I am trying to figure out how to use the “select” helper in changing a  
> \<%= f.select :year %\>
> 
> but that never works.  
> Any help?  
> try this

\<%= f.select :year ,Time.now.year-100…Time.now.year %\>

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [October 30, 2008, 6:29am UTC](https://www.ruby-forum.com/t/select-helper/152114/3 "2008-10-30T06:29:07Z")

</div>

Nope, that doesn’t work. To clarify, the year part is supposed to be a  
pull down select menu of “Senior, Junior, Sophomore, Freshman”

On Oct 29, 10:11 pm, Thani A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [October 30, 2008, 6:46am UTC](https://www.ruby-forum.com/t/select-helper/152114/4 "2008-10-30T06:46:51Z")

</div>

Thani A. wrote:

> removed\_email\_address@domain.invalid wrote:
> 
> > Nope, that doesn’t work. To clarify, the year part is supposed to be a  
> > pull down select menu of “Senior, Junior, Sophomore, Freshman”
> > 
> > On Oct 29, 10:11ï¿½pm, Thani A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> > post here “new.html.erb” content

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [October 30, 2008, 7:40pm UTC](https://www.ruby-forum.com/t/select-helper/152114/5 "2008-10-30T19:40:54Z")

</div>

That did it, thanks

On Oct 29, 10:43 pm, Thani A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [October 30, 2008, 6:43am UTC](https://www.ruby-forum.com/t/select-helper/152114/6 "2008-10-30T06:43:18Z")

</div>

removed\_email\_address@domain.invalid wrote:

> Nope, that doesn’t work. To clarify, the year part is supposed to be a  
> pull down select menu of “Senior, Junior, Sophomore, Freshman”
> 
> On Oct 29, 10:11ï¿½pm, Thani A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

what is the error ? post it here.  
what is your rails version?

and try this  
\<%= select :obj,:year ,%w{Senior Junior Sophomore Freshman} %\>
