I have two tables:
has_many :students, through: :assessment_students
has_many :assessments, through: :assessment_students
There is another table:
When a new assesssment is created, user can choose a classroom to which assessment belongs and all students of that classroom is assigned to the assessment. Join table (AssessmentStudent) and Assessment table get the updated values.
On show.html of Classroom, I have to show all assessments of that classroom as a dropdown. I am able to get this dropdown displaying the assessments. Now based on the assessment chosen in the dropdown, I have to get student details assigned to that particular assessment (This data is available in join table AssessmentStudent). However, I am not sure how to get the selected dropdown value and loop through all records of AssessmentStudent join table and get the relevant student data.