3 include DataMapper::Resource
4 include DataMapper::Validate
6 property :first_name, String, :length => 50, :nullable => false
7 property :last_name, String, :length => 50, :nullable => false
8 property :company, String, :length => 100
9 property :telephone, String, :length => 20
10 property :address1, String, :length => 200, :nullable => false
11 property :address2, String, :length => 200
12 property :city, String, :length => 50
13 property :postal_code, String, :length => 10
14 property :state_id, Fixnum # foreign-key
15 property :country_code, String # foreign-key
20 validates_presence_of :first_name
21 validates_presence_of :last_name
22 validates_presence_of :address1
23 validates_presence_of :postal_code
25 validates_length_of :first_name, :maximum => 50
26 validates_length_of :last_name, :maximum => 50
27 validates_length_of :address1, :maximum => 255
29 alias :zipcode :postal_code
30 alias :zipcode= :postal_code=
31 alias :province :state
32 alias :province= :state=
35 "#{self.first_name} #{self.last_name}"