LibraryActive

Active Record Associations

Active Record feature for declaring associations between Rails models.

Open source page ↗

Product features

Product features

1. Introduction

2. Rails Philosophy

3.1. Prerequisites

3.2. Creating Your First Rails App

3.3. Directory Structure

3.4. Model-View-Controller Basics

3. Creating a New Rails App

4.1. Autoloading in Development

4. Hello, Rails!

5. Creating a Database Model

belongs_to

Declares a one-to-one or many-to-one association to another model.

Chapters

Getting Started with Rails

has_and_belongs_to_many

Declares a many-to-many association using a join table.

has_many

Declares a one-to-many association to another model.

has_many :through

Declares a many-to-many association through a join model.

has_one

Declares a one-to-one association to another model.

has_one :through

Declares a one-to-one association through a join model.

Polymorphic Associations

Associations that can belong to more than one model.

Single Table Inheritance

Stores multiple models in a single database table.