Associations in Rails

To connect two ActiveRecord models, you can use an association. There are 6 types of associations supported in Rails:

  1. belongs_to
  2. has_one
  3. has_many
  4. has_many :through
  5. has_one :through
  6. has_and_belongs_to_many

Learn how to apply them to your Rails application here.

Advertisements