Associations makes common operations simpler and easy in code and removes unnecessary complexities.It ties objects together using foreign keys. Associations creates a connection between two models.
here is the code which shows Association example:
class Customer < ActiveRecord::Base
has_many :orders, dependent: :destroy
class Order < ActiveRecord::Base