Module: Geocoder::ModelMethods
- Defined in:
- lib/geocoder/railtie.rb
Overview
Methods available in the model class before Geocoder is invoked.
Instance Method Summary collapse
-
#geocoded_by(address_attr, options = {}, &block) ⇒ Object
Set attribute names and include the Geocoder module.
- #geocoder_options ⇒ Object
-
#reverse_geocoded_by(latitude_attr, longitude_attr, options = {}, &block) ⇒ Object
Set attribute names and include the Geocoder module.
Instance Method Details
#geocoded_by(address_attr, options = {}, &block) ⇒ Object
Set attribute names and include the Geocoder module.
33 34 35 36 37 38 39 40 41 |
# File 'lib/geocoder/railtie.rb', line 33 def geocoded_by(address_attr, = {}, &block) geocoder_init( :geocode => true, :user_address => address_attr, :latitude => [:latitude] || :latitude, :longitude => [:longitude] || :longitude, :geocode_block => block ) end |
#geocoder_options ⇒ Object
56 57 58 |
# File 'lib/geocoder/railtie.rb', line 56 def @geocoder_options end |
#reverse_geocoded_by(latitude_attr, longitude_attr, options = {}, &block) ⇒ Object
Set attribute names and include the Geocoder module.
46 47 48 49 50 51 52 53 54 |
# File 'lib/geocoder/railtie.rb', line 46 def reverse_geocoded_by(latitude_attr, longitude_attr, = {}, &block) geocoder_init( :reverse_geocode => true, :fetched_address => [:address] || :address, :latitude => latitude_attr, :longitude => longitude_attr, :reverse_block => block ) end |