how to save has_many checkboxes association in rails in controller?

171 views Asked by At

I have the following models:

1) Shift.

2) Employee.

The relation between them is as follows:

shift has_many employees. and employee belongs_to to a shift.

I want to have a link which leads to a page that has all the shifts as a dropdown and below that I want to have all the employees with checkboxes.

I want to select a shift from the shift dropdown and I want to select all the employees that belong to that shift by using checkboxes in order to assign that shift to the selected employees when i click on the submit button.

How can I implement this in Rails?

0

There are 0 answers