Sha256: 89ce650eff1576a452f9181f5287fc9fd235e2bdc0215c4a6abbc56e5dbb7b13

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

= Addresses

This project rocks and uses MIT-LICENSE.

It allows you use these models:

* Country
* State (belongs to country)
* City (belongs to State)
* Neighborhood (belongs to city)
* Address (Belongs to Neighborhood and City, because neighborhood is not required)

== Installation

## Rails 5

Add this code to your Gemfile:

    gem 'addresses', '~> 0.0.9'

## Rails <= 4

Add this code to your Gemfile:

    gem 'addresses', '0.0.9'

After this, add this line to your routes:

    mount Addresses::Engine => "/addresses"

Copy migrations to your project and execute than to create tables in your database:
    
    rake addresses:install:migrations
    rake db:migrate

If you want populate Contries, States (Brazilian only), Cities (Brazilian only) and Neighborhoods (Brazilian only) use this command:

    rake addresses

Now you can test in console if everything are working:
    
    Addresses::Contry.count

Use these models in your project as: 

    address = Addresses::Address.new
    address.street = "Street name"
    address.number = "Number"
    address.complement = "Complement of address"
    address.zipcode = "zipcode"
    address.city = Address::City.find(city_id)
    address.neighborhood = Address::Neighborhood.find(neighborhood_id)
    address.save

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
addresses-1.0.0 README.rdoc