I need help appointing students to parties. They are in many ways.
<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>
In my controller
def create @batch_student = BatchStudent.new(params[:batch_student]) @batch_student.save end
My routes
resources :students do resources :batch_students end resources :batches
But in my database, it creates it with student_id and batch_id as null
source share