2 # A generic representation of an Address.
5 include DataMapper::Resource
7 property :id, Integer, :serial => true
8 property :first_name, String, :length => 50, :nullable => false
9 property :last_name, String, :length => 50, :nullable => false
10 property :company, String, :length => 100
11 property :telephone, String, :length => 20
12 property :address1, String, :length => 200, :nullable => false
13 property :address2, String, :length => 200
14 property :city, String, :length => 50
15 property :postal_code, String, :length => 10, :nullable => false
16 property :state_id, Integer # foreign-key
17 property :country_code, String # foreign-key
20 belongs_to :country, :through => :state
23 alias :zipcode :postal_code
24 alias :zipcode= :postal_code=
25 alias :province :state
26 alias :province= :state=
29 "#{self.first_name} #{self.last_name}"