class Category < ApplicationRecord
has_many :subcategories
has_many :items
end
class Subcategory < ApplicationRecord
belongs_to :category
has_many :items
end
class Item < ApplicationRecord
belongs_to :user
belongs_to :category
belongs_to :subcategory
end
class User < ApplicationRecord
has_many :item
end