Hi,
I am a newbie in Ruby and Rails. I am trying to create a drop down list
with fixed values but the selected option should be saved in the
database.
I have the table commands. Each command has a status which is selected
from a fixed list. The status field in the database is an integer and
can take the values 1, 2 and 3. My view should present the user a drop
down list with human readable elements that correspond to each of the
integers above. So for 1, 2 and 3 I should present the user a list with
the following words: Pending, Completed, Canceled.
Here is what I did and the result is not what I expected:
<p>
<label for="command_status">Status</label><br/>
<%= select(''command'', ''status'',
options_for_select({''Pending'' => 1,
''Completed'' => 2, ''Canceled'' => 3}))
%>
</p>
This makes a drop down list but the contents are the <option> statements
themselves!! What am I doing wrong?
Thank you,
Petros
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---