Given you have Rails e-commerce website.
There are Product and Category models which have has_and_belongs_to_many relationship.
models/product.rb
class Product
has_and_belongs_to_many :categories
endmodels/category.rb
Given you have Rails e-commerce website.
There are Product and Category models which have has_and_belongs_to_many relationship.
models/product.rb
class Product
has_and_belongs_to_many :categories
endmodels/category.rb