Select helper

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?

[email protected] 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 %>

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. [email protected]

Thani A. wrote:

[email protected] 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. [email protected]
post here “new.html.erb” content

That did it, thanks

On Oct 29, 10:43 pm, Thani A. [email protected]

[email protected] 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. [email protected]

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

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs