Method: Cms::Category#ancestors
- Defined in:
- app/models/cms/category.rb
#ancestors ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'app/models/cms/category.rb', line 30 def ancestors fn = lambda do |cat, parents| if cat.parent_id p = self.class.find(cat.parent) fn.call(p, (parents << p)) else parents.reverse end end fn.call(self, []) end |