Skip to content
Snippets Groups Projects
Commit f744e365 authored by Alex Reisner's avatar Alex Reisner
Browse files

Rename config variable.

Be more descriptive.
parent 6be69a73
Branches
Tags
No related merge requests found
...@@ -186,7 +186,7 @@ module Geocoder ...@@ -186,7 +186,7 @@ module Geocoder
# #
def fetch_coordinates(save = false) def fetch_coordinates(save = false)
coords = Geocoder::Lookup.coordinates( coords = Geocoder::Lookup.coordinates(
send(self.class.geocoder_options[:method_name]) send(self.class.geocoder_options[:address_attr])
) )
unless coords.blank? unless coords.blank?
method = (save ? "update" : "write") + "_attribute" method = (save ? "update" : "write") + "_attribute"
...@@ -212,10 +212,10 @@ ActiveRecord::Base.class_eval do ...@@ -212,10 +212,10 @@ ActiveRecord::Base.class_eval do
## ##
# Set attribute names and include the Geocoder module. # Set attribute names and include the Geocoder module.
# #
def self.geocoded_by(method_name = :location, options = {}) def self.geocoded_by(address_attr, options = {})
class_inheritable_reader :geocoder_options class_inheritable_reader :geocoder_options
write_inheritable_attribute :geocoder_options, { write_inheritable_attribute :geocoder_options, {
:method_name => method_name, :address_attr => address_attr,
:latitude => options[:latitude] || :latitude, :latitude => options[:latitude] || :latitude,
:longitude => options[:longitude] || :longitude :longitude => options[:longitude] || :longitude
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment