Ruby on Rails - has_and_belongs_to_many association in ruby on rails - ruby on rails tutorial - rails guides - rails tutorial - ruby rails
A has_and_belongs_to_many association creates a direct many-to-many connection with another model, with no intervening model.
Example
- if our application includes assemblies and parts, with each assembly having many parts and each part appearing in many assemblies.
- We could declare the models this way: