2014-11-10 15:52:54 +01:00
|
|
|
class Product < ActiveRecord::Base
|
|
|
|
after_initialize :init
|
|
|
|
|
|
|
|
|
|
|
|
def init
|
|
|
|
self.name ||= "FOOBAR"
|
|
|
|
self.sale_price ||= 0
|
|
|
|
self.purchase_price ||= 0
|
2014-11-10 17:06:50 +01:00
|
|
|
self.image_path ||= "/" #paperclip gem
|
2014-11-10 15:52:54 +01:00
|
|
|
end
|
|
|
|
end
|