7 include DataMapper::Resource
8 include DataMapper::Validate
12 'Percent of total order' => 1,
13 'Buy [n] get 1 free' => 2
16 property :id, Fixnum, :serial => true
17 property :code, String, :length => 15, :nullable => false
18 property :discount_type, Fixnum, :default => 0, :nullable => false
19 property :discount_amount, Float, :default => 0.0, :nullable => false
20 property :start, DateTime, :nullable => false
21 property :end, DateTime, :nullable => false
22 property :minimum_cart_value, Float
23 property :description, String, :nullable => false
24 property :store_item_id, Fixnum # foreign-key
27 many_to_one :store_item_id
29 validates_presence_of :code, :discount_amount, :discount_type, :description
30 validates_numericalnes_of :discount_amount