Skip to content

Instantly share code, notes, and snippets.

@lfborjas
Created May 28, 2012 22:04
Show Gist options
  • Save lfborjas/2821407 to your computer and use it in GitHub Desktop.
Save lfborjas/2821407 to your computer and use it in GitHub Desktop.
geocoding
var geocoder = new google.maps.Geocoder()
$("#tour_address").autocomplete({
minLength: 3,
source: function(input, callback){
try{
var results = geocoder.geocode({address: input.term}, function(results, status){
if(status == google.maps.GeocoderStatus.OK){
callback(_(results).pluck('formatted_address'))
} else {
callback([])
}
})
}catch(e){
callback([])
}
}
})
add_column :branches, :latitude, :decimal, :precision => 15, :scale => 10
add_column :branches, :longitude, :decimal, :precision => 15, :scale => 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment