Started moving, deleting to prepare for conversion to a slice
[merb_mart.git] / app / models / shipping / type.rb
blobe20a90cad5be7dcf4d976c89d486404b9a54808c
1 require "bigdecimal"
3 module Mart
4   module Shipping
5     class Type
7       include DataMapper::Resource
9       attr_accessor :calculated_price
11       property :id,          Integer,    :serial => true
12       property :name,        String,    :length => 100,   :nullable => false
13       property :code,        String,    :length => 50
14       property :is_domestic, TrueClass, :default => true, :nullable => false
15       property :price,       BigDecimal,:default => 0.0,  :nullable => false
17       has n, :orders
18       has n, :weights, :class_name => 'OrderShippingWeight' #, :dependent => :destroy
20       def self.get_domestic
21         all(:is_domestic => true, :order => "price ASC")
22       end
24       def self.get_foreign
25         all(:is_domestic => false, :order => "price ASC")
26       end
28     end
29   end
30 end