Ruby on Rails - has_many:through association in ruby on rails - ruby on rails tutorial - rails guides - rails tutorial - ruby rails
A has_many :through association is often used to set up a many-to-many connection with another model. This association indicates that the declaring model can be matched with zero or more instances of another model by proceeding through a third model.
Example
- Consider a medical practice where patients make appointments to see physicians.
- The relevant association declarations could look like this: