Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Demonstrates a reference implementation for handling countries, regions, and addresses

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 app
Octocat-spinner-32 generators
Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 CHANGELOG.rdoc
Octocat-spinner-32 Gemfile
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.rdoc
Octocat-spinner-32 Rakefile
Octocat-spinner-32 has_addresses.gemspec
Octocat-spinner-32 init.rb
README.rdoc

has_addresses

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

Resources

API

Bugs

Development

Testing

Source

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

Mailing List

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.

Installation

has_addresses requires additional database tables to work. You can generate a migration for these tables like so:

script/generate has_addresses

Then simply migrate your database:

rake db:migrate

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

Something went wrong with that request. Please try again.