Forum: Ruby on Rails undefined method `scope' for non ActiveRecord class

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ee0293412faca21e4ebf3326ed9d5f8c?d=identicon&s=25 Kad Kerforn (kadoudal)
on 2012-07-21 23:50
(Received via mailing list)
I am trying to use the geocoding capabilities into a table less
model , but the method :scope is not defined ..
is there a way to include it ?


class SearchLocation
  require 'geocoder'
  include ActiveModel::Validations
  include ActiveModel::Conversion
  extend ActiveModel::Naming
  extend Geocoder::Model::ActiveRecord  # extending the class w
geocoding capaibilities ( from geocoder)

  geocoded_by :address
  reverse_geocoded_by :latitude, :longitude
...

I get the error in the geocoder/stores/active_record.rb :  # scope:
geocoded objects

...lib/geocoder/stores/active_record.rb

require 'geocoder/stores/base'
# Add geocoding functionality to any ActiveRecord object.
module Geocoder::Store
  module ActiveRecord
    include Base
    # Implementation of 'included' hook method.
    def self.included(base)
      base.extend ClassMethods
      base.class_eval do

        # scope: geocoded objects
        scope :geocoded, lambda {  # this raises the error

any feedback welcome
This topic is locked and can not be replied to.