Class: KktShoppe::ProductCategory
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- KktShoppe::ProductCategory
- Defined in:
- app/models/kkt_shoppe/product_category.rb
Instance Method Summary collapse
- #attachments=(attrs) ⇒ Object
- #combined_permalink ⇒ Object
-
#hierarchy_array ⇒ Object
Return array with all the product category parents hierarchy in descending order.
-
#image ⇒ String
Attachment with the role image.
Instance Method Details
#attachments=(attrs) ⇒ Object
39 40 41 |
# File 'app/models/kkt_shoppe/product_category.rb', line 39 def (attrs) if attrs["image"]["file"].present? then self..build(attrs["image"]) end end |
#combined_permalink ⇒ Object
43 44 45 46 47 48 49 |
# File 'app/models/kkt_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_array ⇒ Object
Return array with all the product category parents hierarchy in descending order
53 54 55 56 |
# File 'app/models/kkt_shoppe/product_category.rb', line 53 def hierarchy_array return [self] unless parent parent.hierarchy_array.concat [self] end |
#image ⇒ String
Attachment with the role image
61 62 63 |
# File 'app/models/kkt_shoppe/product_category.rb', line 61 def image self..for("image") end |