Sha256: 51c3d7b1ea64433d4123c7deab9a255e88170af9abb7966cd66251d3739d1ff1
Contents?: true
Size: 1.24 KB
Versions: 4
Compression:
Stored size: 1.24 KB
Contents
require 'geocoder/models/base' module Geocoder module Model module Mongoid include Base def self.included(base); base.extend(self); end ## # Set attribute names and include the Geocoder module. # def geocoded_by(address_attr, options = {}, &block) geocoder_init( :geocode => true, :user_address => address_attr, :coordinates => options[:coordinates] || :coordinates, :geocode_block => block ) end ## # Set attribute names and include the Geocoder module. # def reverse_geocoded_by(coordinates_attr, options = {}, &block) geocoder_init( :reverse_geocode => true, :fetched_address => options[:address] || :address, :coordinates => coordinates_attr, :reverse_block => block ) end private # -------------------------------------------------------------- def geocoder_file_name; "mongoid"; end def geocoder_module_name; "Mongoid"; end def geocoder_init(options) super(options) index [[ geocoder_options[:coordinates], Mongo::GEO2D ]], :min => -180, :max => 180 # create 2d index end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
geocoder-1.0.1 | lib/geocoder/models/mongoid.rb |
geocoder-1.0.0 | lib/geocoder/models/mongoid.rb |
geocoder-0.9.13 | lib/geocoder/models/mongoid.rb |
geocoder-0.9.12 | lib/geocoder/models/mongoid.rb |