What is the correct way to define one to many association in rails 5.we
have currently the following migration files…we have to define
products and categories tables such that one category has many products.
class Category < ApplicationRecord
has_many :products, dependent: :destroy
class Product < ApplicationRecord
belongs_to :category, index: true