lib/geocoder/models/mongo_base.rb in geocoder-1.1.1 vs lib/geocoder/models/mongo_base.rb in geocoder-1.1.2
- old
+ new
@@ -14,11 +14,14 @@
def geocoded_by(address_attr, options = {}, &block)
geocoder_init(
:geocode => true,
:user_address => address_attr,
:coordinates => options[:coordinates] || :coordinates,
- :geocode_block => block
+ :geocode_block => block,
+ :units => options[:units],
+ :method => options[:method],
+ :skip_index => options[:skip_index] || false
)
end
##
# Set attribute names and include the Geocoder module.
@@ -26,30 +29,32 @@
def reverse_geocoded_by(coordinates_attr, options = {}, &block)
geocoder_init(
:reverse_geocode => true,
:fetched_address => options[:address] || :address,
:coordinates => coordinates_attr,
- :reverse_block => block
+ :reverse_block => block,
+ :units => options[:units],
+ :method => options[:method],
+ :skip_index => options[:skip_index] || false
)
end
private # ----------------------------------------------------------------
def geocoder_init(options)
unless geocoder_initialized?
- @geocoder_options = {}
+ @geocoder_options = { }
require "geocoder/stores/#{geocoder_file_name}"
include Geocoder::Store.const_get(geocoder_module_name)
end
@geocoder_options.merge! options
end
def geocoder_initialized?
- begin
- included_modules.include? Geocoder::Store.const_get(geocoder_module_name)
- rescue NameError
- false
- end
+ included_modules.include? Geocoder::Store.const_get(geocoder_module_name)
+ rescue NameError
+ false
end
end
end
end
+