Solved it.
VIEW
<%= select ("proCodes", "id", @productCode.map {|u|
[u.value,u.id]})
%>
On 24 May, 10:05, slippy
<handle...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
> For more options, visit this group
athttp://groups.google.com/group/rubyonrails-talk?hl=en.
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
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.