Class: Shoppe::ProductCategory

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/shoppe/product_category.rb

Instance Method Summary collapse

Instance Method Details


39
40
41
42
43
44
45
# File 'app/models/shoppe/product_category.rb', line 39

def combined_permalink
  if self.permalink_includes_ancestors && self.ancestral_permalink.present?
    "#{self.ancestral_permalink}/#{self.permalink}"
  else
    self.permalink
  end
end

#hierarchy_arrayObject

Return array with all the product category parents hierarchy in descending order


49
50
51
52
# File 'app/models/shoppe/product_category.rb', line 49

def hierarchy_array
  return [self] unless parent
  parent.hierarchy_array.concat [self]
end

#imageString

Attachment with the role image

Returns:

  • (String)

57
58
59
# File 'app/models/shoppe/product_category.rb', line 57

def image
  self.attachments.for("image")
end