I am trying to create a simple form for a student to select list of courses and enter remarks for each of the course
- course is a lookup table with name field
- student with name field etc..
- association table with course id, student-id,remarks
these are the associations I have in student model
has_many :course_associations
has_many :courses, :through=> :course_associations
accepts_nested_attributes_for :course_associations
accepts_nested_attributes_for :courses
I have to create a form using rails 4 simple form that lists out all courses as check boxes and text field next to each check-box to fill in remarks for that course. I am able to generate the checkboxes fine but not sure how to create textbox next to each course..below is what I have..
<% Course.all.each do |course| %>
<div class="col-lg-5 col-md-5">
<%= check_box_tag "student[course_ids][]", course.id,
course.id.in?(@student.course_ids),
{
id: "student_course_ids_" + course.id.to_s
}%>
<%= label(:student, "course_ids_" + course.id.to_s, course.name) %>
**need to create text box for extra field in course association**
</div>
<%end%>