Drop down lists

Hi everyone,

I am now building a form, and for a field i want to give users only a
small set of predetermined values.
I implemented it as follows:

in the controller i created an array
@ptypes = [“type a”, “type b”, …]

in the _form
<%= collection_select :purchase, :product, @ptypes, :to_s, :to_s %>

I am new to rails, and would like to know if there is a standard way
for doing this.


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