Class: Shoppe::ProductCategory

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

Instance Method Summary collapse

Instance Method Details

#attachments=(attrs) ⇒ Object



39
40
41
# File 'app/models/shoppe/product_category.rb', line 39

def attachments=(attrs)
  if attrs["image"]["file"].present? then self.attachments.build(attrs["image"]) end
end


43
44
45
46
47
48
49
# File 'app/models/shoppe/product_category.rb', line 43

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



53
54
55
56
# File 'app/models/shoppe/product_category.rb', line 53

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

#imageString

Attachment with the role image

Returns:

  • (String)


61
62
63
# File 'app/models/shoppe/product_category.rb', line 61

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