Class: MechanizeStore::Product
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- MechanizeStore::Product
- Defined in:
- app/models/mechanize_store/product.rb
Instance Method Summary collapse
Instance Method Details
#create_slug ⇒ Object
20 21 22 |
# File 'app/models/mechanize_store/product.rb', line 20 def create_slug self.update_attributes(:slug => "#{self.id}-#{self.name.parameterize}") end |
#first_photo ⇒ Object
11 12 13 14 |
# File 'app/models/mechanize_store/product.rb', line 11 def first_photo return nil if self.product_photos.empty? return self.product_photos.first end |
#set_defaults ⇒ Object
16 17 18 |
# File 'app/models/mechanize_store/product.rb', line 16 def set_defaults self.slug = "#{self.id}-#{self.name.parameterize}" end |