Changed State to use composite, natural keys.
[merb_mart.git] / app / models / state.rb
blob90fbe7bbe129482fd2b34f80640607992e7df9ff
2 # A representation of a State, Province, or sub-national administrative
3 # division, for those countries that use such administrative divisions.
5 # Useful for the purposes of addresses, local taxation purposes, etc.
7 # e.g.
8 #   US State                          => New York/NY
9 #   Canadian Province                 => Alberta/AB
10 #   UK Province/Constituent Country   => Northern Ireland
11 #   German Bundesland                 => Baden-Württemburg/BW
13 class State
15   include DataMapper::Resource
17   property :country_code, String, :key => true  # foreign-key, ISO 3166-1 alpha-2
18   property :abbr,         String, :key => true, :length => 10
19   property :name,         String,               :length => 50, :nullable => false
20   
21   belongs_to :country
22   
23 end