Re: howto implement a join table

rogi
Wed, 16 Feb 2011 21:50:13 -0000

implemented Ar Chrons idea.

Now I wanted to replace the text fields with select boxes.
They look right and let me select values, but the table fields for
worker_id and course_id

don''t get filled: [#<Training id: 1, worker_id: nil, course_id:
nil, ...

my form partial _form.html.erb looks like:
.....

	<%= select_tag ''worker_id'',
options_for_select(Worker.all.collect { |
w| [w.first_name+" "+w.last_name, w.id] }) %>



    <%= select_tag ''course_id'',
options_for_select(Course.all.collect
{ |c| [c.name, c.id] }) %>



<%= f.label :start_date %>
    <%= f.datetime_select :start_date %>

......