Associations (has_many, belongs_to, etc.)
Associations in Rails
ActiveRecord associations simplify relationships between models.
has_many :comments
belongs_to :article
has_one :profile
has_many :through
andhas_and_belongs_to_many
for complex associations
Use rails generate migration
to add foreign keys (e.g., article_id
).