forked from alexreisner/geocoder
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move geocoded_by method from init.rb to lib/geocoder.rb.
- Loading branch information
1 parent
6267b19
commit 2753a11
Showing
2 changed files
with
32 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1 @@ | ||
ActiveRecord::Base.class_eval do | ||
|
||
## | ||
# Include the Geocoder module and set attribute names. | ||
# | ||
def self.geocoded_by(method_name = :location, options = {}) | ||
class_inheritable_reader :geocoder_options | ||
write_inheritable_attribute :geocoder_options, { | ||
:method_name => method_name, | ||
:latitude => options[:latitude] || :latitude, | ||
:longitude => options[:longitude] || :longitude | ||
} | ||
include Geocoder | ||
end | ||
end | ||
require 'geocoder' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters