我需要帮助分配学生批次..他们是在多对多的关系。帮助与rails link_to和发布方法
<tbody>
<% Batch.all.each do |b|%>
<tr>
<td><%= b.course.name%></td>
<td><%= b.name %></td>
<td><%= b.section_name%></td>
<td><%= link_to "Add", student_batch_students_path(@student, :batch_id=> b.id), :method=> :post%></td>
</tr>
<%end%>
</tbody>
在我的控制器
def create
@batch_student = BatchStudent.new(params[:batch_student])
@batch_student.save
end
我的路线
resources :students do
resources :batch_students
end
resources :batches
但在我的数据库将其与student_id数据和BATCH_ID为空
你得到什么错误? – fl00r 2011-04-28 17:11:50
我在原文中增加了更多细节 – ignaciofuentes 2011-04-28 17:12:47
显示你的'student_batch'动作和你的路线 – fl00r 2011-04-28 17:13:02