Update geocode latitude and longitude everytime address is updated
问题 I have this in my shop.rb : def geocode_address if !address_geo.blank? geo=Geokit::Geocoders::MultiGeocoder.geocode(address_geo) errors.add(:address, "Could not Geocode address") if !geo.success self.lat, self.lng = geo.lat,geo.lng if geo.success end end # Checks whether this object has been geocoded or not. Returns the truth def geocoded? lat? && lng? end And in my shops_controller.rb : def update @shop = Shop.find(params[:id]) if @shop.update_attributes(params[:shop]) flash[:notice] =