[Rails] select_tag taking input from database
hey, its my first day developing with ruby and i am having some
trouble getting data from a find and then putting it in a select drop
down.
here is my code,
IN MY CONTROLLER
@foundCode = Code.find(:all)
IN MY VIEW
<%= f.select_tag 'code', options_for_select(@foundCode) %>
THE OBJECT
- !ruby/object:Code
attributes:
name: Locations
created_at: 2010-05-22 09:57:42
updated_at: 2010-05-22 10:17:10
id: "2"
value: NY
attributes_cache: {}
- !ruby/object:Code
attributes:
name: Locations
created_at: 2010-05-22 10:16:58
updated_at: 2010-05-22 10:16:58
id: "6"
value: London
attributes_cache: {}
Thanks
Alex
--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home