You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
413 B
14 lines
413 B
module Dashboard
|
|
class Category < ApplicationRecord
|
|
include FriendlyId
|
|
friendly_id :name, use: [:slugged]
|
|
|
|
scope :sorted, -> { order(:category_id) }
|
|
|
|
has_many :subcategories, class_name: "Subcategory", foreign_key: :dashboard_categories_id
|
|
has_many :measures, through: :subcategories
|
|
has_many :admin_data_items, through: :measures
|
|
has_many :scales, through: :subcategories
|
|
end
|
|
end
|