I'm looking to create the following models in Rails 5:
Industry
Department
JobTitle
Example Data:
Industry: Technology, Healthcare, Other
Department: Admin, Customer Support
JobTitle: Account Manager, Accountant
Industry is the highest-level, departments can belong to one or more industries and Job titles can belong to one or more departments.
I have the three models above created in Rails, what I don't have is, given an Industry and department, how do I get all the JobTitles?
How should I store this relationship and then how do I query to get it?
Should I create a 3 table join model like:
IndustriesDepartmentsJobTitles
id | industry_id | department_id | job_title_id
Would that be the right way to do it? If so, how would I then query for the job_titles give an industry_id & department_id?