| Module | GeoKit::ActsAsMappable |
| In: |
vendor/plugins/geokit/lib/geo_kit/acts_as_mappable.rb
|
Contains the class method acts_as_mappable targeted to be mixed into ActiveRecord. When mixed in, augments find services such that they provide distance calculation query services. The find method accepts additional options:
Other finder methods are provided for specific queries. These are:
Counter methods are available and work similarly to finders.
If raw SQL is desired, the distance_sql method can be used to obtain SQL appropriate to use in a find_by_sql call.
this is the callback for auto_geocoding
# File vendor/plugins/geokit/lib/geo_kit/acts_as_mappable.rb, line 79
79: def auto_geocode_address
80: address=self.send(auto_geocode_field)
81: geo=GeoKit::Geocoders::MultiGeocoder.geocode(address)
82:
83: if geo.success
84: self.send("#{lat_column_name}=", geo.lat)
85: self.send("#{lng_column_name}=", geo.lng)
86: else
87: errors.add(auto_geocode_field, auto_geocode_error_message)
88: end
89:
90: geo.success
91: end