feat: Category API to handle linked categories and parent-sub categories (#4879)

This commit is contained in:
Tejaswini Chile
2022-06-28 11:23:20 +05:30
committed by GitHub
parent c0249a1b5b
commit df1bf112ea
15 changed files with 286 additions and 29 deletions

View File

@@ -0,0 +1,19 @@
# == Schema Information
#
# Table name: related_categories
#
# id :bigint not null, primary key
# created_at :datetime not null
# updated_at :datetime not null
# category_id :bigint
# related_category_id :bigint
#
# Indexes
#
# index_related_categories_on_category_id_and_related_category_id (category_id,related_category_id) UNIQUE
# index_related_categories_on_related_category_id_and_category_id (related_category_id,category_id) UNIQUE
#
class RelatedCategory < ApplicationRecord
belongs_to :related_category, class_name: 'Category'
belongs_to :category, class_name: 'Category'
end