Module: Geocoder::Orm::ActiveRecord::Legacy
- Included in:
- Geocoder::Orm::ActiveRecord
- Defined in:
- lib/geocoder/orms/active_record_legacy.rb
Instance Method Summary collapse
- #fetch_address(*args) ⇒ Object
-
#fetch_address! ⇒ Object
Fetch address and update (save)
address
data. - #fetch_coordinates(*args) ⇒ Object
-
#fetch_coordinates! ⇒ Object
Fetch coordinates and update (save)
latitude
andlongitude
data.
Instance Method Details
#fetch_address(*args) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/geocoder/orms/active_record_legacy.rb', line 49 def fetch_address(*args) warn "DEPRECATION WARNING: The 'fetch_address' method will cease taking " + "an argument in geocoder v1.0. Please save your objects manually." if args.size > 0 do_lookup(true) do |o,rs| r = rs.first unless r.latitude.nil? or r.longitude.nil? method = ((args.size > 0 && args.first) ? "update" : "write" ) + "_attribute" o.send method, self.class.[:fetched_address], r.address end r.address end end |
#fetch_address! ⇒ Object
Fetch address and update (save) address
data.
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/geocoder/orms/active_record_legacy.rb', line 37 def fetch_address! warn "DEPRECATION WARNING: The 'fetch_address!' method is deprecated and will be removed in geocoder v1.0. " + "Please use 'reverse_geocode' instead and then save your objects manually." do_lookup(true) do |o,rs| r = rs.first unless r.address.nil? o.send :update_attribute, self.class.[:fetched_address], r.address end r.address end end |
#fetch_coordinates(*args) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/geocoder/orms/active_record_legacy.rb', line 20 def fetch_coordinates(*args) warn "DEPRECATION WARNING: The 'fetch_coordinates' method will cease taking " + "an argument in geocoder v1.0. Please save your objects manually." if args.size > 0 do_lookup(false) do |o,rs| r = rs.first unless r.latitude.nil? or r.longitude.nil? method = ((args.size > 0 && args.first) ? "update" : "write" ) + "_attribute" o.send method, self.class.[:latitude], r.latitude o.send method, self.class.[:longitude], r.longitude end r.coordinates end end |
#fetch_coordinates! ⇒ Object
Fetch coordinates and update (save) latitude
and longitude
data.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/geocoder/orms/active_record_legacy.rb', line 7 def fetch_coordinates! warn "DEPRECATION WARNING: The 'fetch_coordinates!' method is deprecated and will be removed in geocoder v1.0. " + "Please use 'geocode' instead and then save your objects manually." do_lookup(false) do |o,rs| r = rs.first unless r.latitude.nil? or r.longitude.nil? o.send :update_attribute, self.class.[:latitude], r.latitude o.send :update_attribute, self.class.[:longitude], r.longitude end r.coordinates end end |