Rails: present a "choose from" to fill an attribute -
as first q on stackoverflow ... please gentle?
when assigning value attribute in table (f.e. projects, :project_owner), want present "choose from", consisting of objects table b (f.e. people, :person_name) , commit chosen 1 ...
so best practice?
thnx in advance ...
collection_select
you:
<%= form_for @project |f| %> <%= f.collection_select :owner_id, person.all, :id, :name %> <%= f.submit %> <% end %>
Comments
Post a Comment