This query actually encompasses two related inquiries.
- Enabling "Select all" functionality - In the realm of formtastic, which is used by Active_admin to render forms, how can I implement a button that selects all checkboxes present on the page? While achieving this using JavaScript is plausible, I am uncertain about the process within formtastic.
Adjusting collection based on selection: Within a dropdown menu offering a list of courses for selection, I aim to dynamically display a checkbox list containing students enrolled in the chosen course. Essentially, the list of students ought to update based on the course selected by the user.
course.rb
has_and_belongs_to_many :students
student.rb
has_and_belongs_to_many :courses