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

Solved it.

VIEW
<%= select (“proCodes”, “id”, @productCode.map {|u| [u.value,u.id]})
%>