mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
working on displaying data
This commit is contained in:
parent
74ff33d74e
commit
a8862d1734
10 changed files with 140 additions and 130 deletions
|
|
@ -9,12 +9,15 @@ class Category < ApplicationRecord
|
|||
|
||||
scope :for_parent, -> (category=nil) { where(parent_category_id: category.try(:id)) }
|
||||
|
||||
def root_identifier
|
||||
def path
|
||||
p = self
|
||||
while p.parent_category.present?
|
||||
p = p.parent_category
|
||||
end
|
||||
p.name.downcase.gsub(/\s/, '-')
|
||||
items = [p]
|
||||
items << p while (p = p.try(:parent_category))
|
||||
items.uniq.compact.reverse
|
||||
end
|
||||
|
||||
def root_identifier
|
||||
path.first.name.downcase.gsub(/\s/, '-')
|
||||
end
|
||||
|
||||
def root_index
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue