Jr. Ruby on Rails Dev | Math Enthusiast | Ex-Machine Learning Engineer | https://juzershakir.github.io/

An elaboration of has_many, has_many-:through & HABTM associations.

Prerequisite:

Table of Contents

has_many

has_many — :through
one-to-many
many-to-many

has_and_belongs_to_many

has_many-:through or has_and_belong_to_many?

Relationships

Following topics to be covered in this article

The belongs_to, has_one and has_one-:through associations are discussed in my previous article. In this article, we will discuss, has_many, has_many-:through and has_and_belongs_to_many associations.

has_many

has_many

Generating migration files.

Prerequisite:

Table of Contents

Definition

Migration File
Name format
create_table
references
comment

Alternate ways to create a table

Unique & Index

Definition

Migration is one of the features of Active Record which enables us to modify our table in database in a structured and…

Juzer Shakir

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store