0

This is a conceptual question, not a gimme the code question.

I'm working with 4 models: Doctor, Specialization, School, Service

Doctor has mutual HABTM associations with the other 3 models, and 3 joins tables have been created to hold these associations:

doctors_specializations
doctors_schools
doctors_services

Queries from front-end users will need to access all doctors with specified criteria held in the other 3 tables.

Example: Return all doctors who went to Harvard, specialize in face lifts, and offer some type of related ancillary service.

What is the best way to accomplish this?

Ken Corley
  • 13
  • 5

1 Answers1

0

Better to have only Doctor model and you can have 3 flags with each case. And you can create 3 scopes in Doctor model with the 3 cases you have.

scope :specialized, where(specialized: true)