Module: Drifter::Rails

Defined in:
lib/drifter-rails.rb,
lib/drifter-rails/version.rb,
lib/drifter-rails/class_methods.rb,
lib/drifter-rails/instance_methods.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Constant Summary collapse

VERSION =
"0.1.3"

Instance Method Summary collapse

Instance Method Details

#acts_as_drifter(options = {}) ⇒ Object

supported_options:

:lat_column - the name of the column holding latitude values (default is lat)
:lng_column - the name of the column holding longitude values (default is lng)


12
13
14
15
16
17
18
19
20
21
22
# File 'lib/drifter-rails.rb', line 12

def acts_as_drifter(options={})
  # determine the names of the lat and lng columns
  lat_col = options[:lat_column] || :lat
  lng_col = options[:lng_column] || :lng

  eval("def self.lat_column_name; :#{lat_col}; end")
  eval("def self.lng_column_name; :#{lng_col}; end")

  extend Drifter::Rails::ClassMethods
  include Drifter::Rails::InstanceMethods
end