public
Description: Demonstrates a reference implementation for handling countries, regions, and addresses
Homepage: http://www.pluginaweek.org
Clone URL: git://github.com/pluginaweek/has_addresses.git
obrie (author)
Fri May 01 18:20:38 -0700 2009
commit  320df2b29789dbbb45f1c6539999591decd0913c
tree    336b2994d16eb2e4dc0ea76453a2fc19986a2861
parent  1ed865c9833cd504916969882a736926949cefe7
name age message
file .gitignore Fri Jul 04 15:48:04 -0700 2008 Ignore test/app_root/script [obrie]
file CHANGELOG.rdoc Loading commit data...
file LICENSE Thu Apr 30 19:00:36 -0700 2009 Replace acts_as_enumeration with enumerate_by A... [obrie]
file README.rdoc
file Rakefile
directory app/
directory db/ Thu Apr 30 19:00:36 -0700 2009 Replace acts_as_enumeration with enumerate_by A... [obrie]
file init.rb Sun Jul 22 13:00:39 -0700 2007 Initial release [obrie]
directory lib/ Thu Apr 30 19:00:36 -0700 2009 Replace acts_as_enumeration with enumerate_by A... [obrie]
directory test/
README.rdoc

has_addresses

has_addresses demonstrates a reference implementation for handling countries, regions, and addresses.

Resources

API

Bugs

Development

Source

  • git://github.com/pluginaweek/has_addresses.git

Description

Countries, regions, and addresses are all simple models whose data and functionality should be able to be standardized across multiple applications. has_addresses adds support for countries and regions based on the ISO 3166 and ISO 3166-2 standard. The data for these standards is obtained through the open-source Debian package, iso-codes.

Along with the simple Country and Region models, addresses can be defined and integrated based on the data in these models. Addresses are minimalistic in terms of the type of data required.

Usage

Note that this is a reference implementation and, most likely, should be modified for your own usage.

Example

  address = Address.new(
    :street_1 => '1600 Amphitheatre Parkway',
    :city => 'Mountain View',
    :region => 'US-CA',
    :postal_code => '94043'
  )
  address.single_line # => "1600 Amphitheatre Parkway, Mountain View, California  94043, United States"

Testing

Before you can run any tests, the following gem must be installed:

To run against a specific version of Rails:

  rake test RAILS_FRAMEWORK_ROOT=/path/to/rails

Dependencies