Class: EtabliocmsActualities::Category

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/etabliocms_actualities/category.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#child_ofObject

Returns the value of attribute child_of.



7
8
9
# File 'app/models/etabliocms_actualities/category.rb', line 7

def child_of
  @child_of
end

Instance Method Details

#other_categories_for_selectObject



20
21
22
23
24
# File 'app/models/etabliocms_actualities/category.rb', line 20

def other_categories_for_select
  categories = EtabliocmsActualities::Category.order("lft ASC")
  categories = categories.where("id != ?", id) unless new_record?
  categories.map { |d| [d.title, d.id] }
end

#pathObject



16
17
18
# File 'app/models/etabliocms_actualities/category.rb', line 16

def path
  self_and_ancestors.map(&:slug).join("/")
end