I have a customer model with the following collection: @practices = Customer.joins(:user).where(users: {role: User.roles[:doctor]}) , which joins the user table and customer tables where user role is "doctor".
In my customers index view currently I am listing all the customers, now I want to add a search filter using a Drop down list with a search button, where the list contains the first name of the Doctors. If I press the search button it should show only customers created by that particular doctor selected from the drop down list.
1. How to add a drop down list with search button which displays only first names of doctors ?
2. How to filter my customers listing when I select a particular doctor from the drop down and click on search button ?
Aucun commentaire:
Enregistrer un commentaire