README.md in peripatetic-0.0.1 vs README.md in peripatetic-0.0.2

- old
+ new

@@ -1,11 +1,20 @@ -# Peripatetic +Peripatetic +This gem adds location functionality to any app it create 3 tables in the database (locations, countries, and postal_codes) and populates countries and postal_codes from a compressed yaml file. One may specify wether it be has_one or has_many. The countries and postal_codes table are just look up tables. in the form partial the gem guesses the country and zip code from the ip and fills it in. If it takes too long or the data is not there it doesn't populate it. The country table has a position field which you can use to order the countries. If a user adds a street address then it geocodes it and adds the updated lat lng to the locations table. -TODO: Write a gem description +the postal codes are from geonames and the f -## Installation +countries db is from https://github.com/hexorx/countries +the postal_codes db is from http://download.geonames.org/export/dump/ and http://federalgovernmentzipcodes.us/ +The US postal_codes lat and lng columns have been recently updated. + + +Drop in Location for any model has_one or has_many, creates a nested association and allows you to drop into your form a partial + +Installation: + Add this line to your application's Gemfile: gem 'peripatetic' And then execute: @@ -14,12 +23,32 @@ Or install it yourself as: $ gem install peripatetic -## Usage +Usage: -TODO: Write usage instructions here +Add include Peripatetic to the model you want locations +then just drop in nested form into the form + +<%= f.fields_for peripatetic_locations(model, number_of_times_to_build) do |builder| %><br> + <% if builder.object.new_record? %><br> + <%= builder.hidden_field :ip, :value => ip_address %><br> + <div class="field"> + <%= builder.label :street %><br /> + <%= builder.text_field :street %> + </div> + <div class="field"> + <%= builder.label :accessor_postal_code, "Postal Code" %><br /> + <%= builder.text_field :accessor_postal_code, :value => get_accessor_postal_code(builder.object)[:postal_code] %> + </div> + <div class="field"> + <%= builder.label :accessor_country, "Country" %><br /> + <%= builder.country_select :accessor_country, get_accessor_postal_code(builder.object)[:country] %> + </div> + <% end %><br> +<% end %><br> + ## Contributing 1. Fork it 2. Create your feature branch (`git checkout -b my-new-feature`)