138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
# File 'lib/acts_as_gmappable/base.rb', line 138
def process_geocoding
return true if gmaps4rails_options[:check_process] == true && self.send(gmaps4rails_options[:checker]) == true
begin
coordinates = Gmaps4rails.geocode(self.send(gmaps4rails_options[:address]))
rescue GeocodeStatus
errors[gmaps4rails_options[:address]] << gmaps4rails_options[:msg] if gmaps4rails_options[:validation]
rescue GeocodeNetStatus => e
logger.warn(e)
else
self[gmaps4rails_options[:lng_column]] = coordinates.first[:lng]
self[gmaps4rails_options[:lat_column]] = coordinates.first[:lat]
unless gmaps4rails_options[:normalized_address].nil?
self.send(gmaps4rails_options[:normalized_address].to_s+"=", coordinates.first[:matched_address])
end
if gmaps4rails_options[:check_process] == true
self[gmaps4rails_options[:checker]] = true
end
end
end
|