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