Skip to content
Snippets Groups Projects
Commit 0b6c6e1a authored by Christopher Manning's avatar Christopher Manning
Browse files

Change lat and lon configurations in README to latitude and longitude so it...

Change lat and lon configurations in README to latitude and longitude so it matches the gem's defaults and the generate migration instructions
parent 833fcf3c
No related branches found
No related tags found
No related merge requests found
......@@ -50,7 +50,7 @@ Next, your model must tell Geocoder which method returns your object's geocodabl
For reverse geocoding, tell Geocoder which attributes store latitude and longitude:
reverse_geocoded_by :lat, :lon
reverse_geocoded_by :latitude, :longitude
after_validation :reverse_geocode # auto-fetch address
=== Mongoid
......@@ -190,7 +190,7 @@ If your model has +street+, +city+, +state+, and +country+ attributes you might
For reverse geocoding you can also specify an alternate name attribute where the address will be stored, for example:
reverse_geocoded_by :lat, :lon, :address => :location # ActiveRecord
reverse_geocoded_by :latitude, :longitude, :address => :location # ActiveRecord
reverse_geocoded_by :coordinates, :address => :loc # MongoDB
......@@ -198,7 +198,7 @@ For reverse geocoding you can also specify an alternate name attribute where the
So far we have looked at shortcuts for assigning geocoding results to object attributes. However, if you need to do something fancy you can skip the auto-assignment by providing a block (takes the object to be geocoded and an array of <tt>Geocoder::Result</tt> objects) in which you handle the parsed geocoding result any way you like, for example:
reverse_geocoded_by :lat, :lon do |obj,results|
reverse_geocoded_by :latitude, :longitude do |obj,results|
if geo = results.first
obj.city = geo.city
obj.zipcode = geo.postal_code
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment