Class | Category |
In: |
app/models/category.rb
|
Parent: | ActiveRecord::Base |
# File app/models/category.rb, line 35 35: def self.columns_for_index 36: [ {:label => "Name", :method => :name, :order => "categories.name" }, 37: {:label => "Type", :method => :category_type_name, :order => "category_types.name" }, 38: {:label => "Updated On", :method => :updated_on_string, :order => "categories.updated_at"} ] 39: end
# File app/models/category.rb, line 16 16: def ancestors 17: fn = lambda do |cat, parents| 18: if cat.parent_id 19: p = self.class.find(cat.parent) 20: fn.call(p, (parents << p)) 21: else 22: parents.reverse 23: end 24: end 25: fn.call(self, []) 26: end
# File app/models/category.rb, line 32 32: def category_type_name 33: category_type ? category_type.name : nil 34: end