Skip to content

Instantly share code, notes, and snippets.

@gogotanaka
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gogotanaka/8b3c3317b5be971dc755 to your computer and use it in GitHub Desktop.
Save gogotanaka/8b3c3317b5be971dc755 to your computer and use it in GitHub Desktop.
Add lat and lng to venue
Venue.where("latitude IS NULL").map{|v| v.latitude = v.location.lat; v.longitude = v.location.lng;v.save }
Venue.where("latitude IS NULL").
Venue.where("dbapp_id IS NULL").each do |v|
lat_lng = GogoMaps.get_latlng(v.location.to_pretty_full) rescue next
v.latitude = lat_lng[:lat]
v.longitude = lat_lng[:lng]
v.save
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment