-
Notifications
You must be signed in to change notification settings - Fork 378
DRY example
apneadiving edited this page May 1, 2012
·
8 revisions
Here is a great DRY piece of code suggested by Mircea Pricop https://github.com/mirceapricop
acts_as_gmappable :lat => 'lat', :lng => 'lng', :process_geocoding => :geocode?,
:address => "address", :normalized_address => "address",
:msg => "Sorry, not even Google could figure out where that is"
def geocode?
!(address.blank? || (!lat.blank? && !lng.blank?))
end
The columns in his db are, lat, lng, address, gmaps.
He uses directly his db column to pass the address to the gem and overwrite the address provided with the one normalized by Google.