Class: Product
- Inherits:
-
Sequel::Model
- Object
- Sequel::Model
- Product
- Defined in:
- lib/pyradise/product.rb
Instance Method Summary collapse
Instance Method Details
#before_save ⇒ Object
3 4 5 6 |
# File 'lib/pyradise/product.rb', line 3 def before_save phist = { Time.now.to_i => price } self[:prices] = Marshal.dump(prices ? prices.merge(phist) : phist) end |
#new_price!(np) ⇒ Object
12 13 14 |
# File 'lib/pyradise/product.rb', line 12 def new_price!(np) self.update(:prices => Marshal.dump(prices ? prices.merge({Time.now.to_i => np}) : np)) end |
#prices ⇒ Object
8 9 10 |
# File 'lib/pyradise/product.rb', line 8 def prices self[:prices] ? Marshal.load(self[:prices]) : nil end |