Help! Can anyone see why my code isn’t inserting the course_id
parameter into my table?
<%= f.label :course_id %>
<% for course in current_user.courses.find(:all, :order =>
'order_taught') %>
<%= check_box_tag 'assessment[course_id][]', course.id %>
<%=h course.name %>
<% end %>
Below, you can see the Development Log. It shows that the parameter
for “course_id”=>[“2”]. But as you can see, the INSERT INTO is
inserting a value of 1 for course_id:
Processing AssessmentsController#create (for 127.0.0.1 at 2010-01-16
16:27:24) [POST]
Parameters: {“commit”=>“Create”,
“authenticity_token”=>“Z8yZOo9q2tz6IC1jmV33qvMO7ULRzcJ8e7q6B0xHP9Y=”,
“assessment”=>{“name”=>"", “date(1i)”=>“2010”, “date(2i)”=>“1”, “date
(3i)”=>“16”, “standard_id”=>“9”, “course_id”=>[“2”],
“strand_id”=>“2”}}
e[4;36;1mUser Load (0.0ms)e[0m e[0;1mSELECT * FROM “users” WHERE
(“users”.“id” = 12) LIMIT 1e[0m
e[4;35;1mAssessment Create (0.0ms)e[0m e[0mINSERT INTO
“assessments” (“name”, “created_at”, “updated_at”, “date”, “user_id”,
“standard_id”, “strand_id”, “course_id”) VALUES(’’, ‘2010-01-17
00:27:24’, ‘2010-01-17 00:27:24’, ‘2010-01-16’, 12, 9, 2, 1)
Any help would be greatly appreciated!