lib/arid_cache/cache_proxy/result_processor.rb
def is_activerecord_reflection?
        result_is_a = lambda do |*types|
          !!types.find do |type|
            case type
            when :scope
              defined?(::ActiveRecord::NamedScope::Scope) && @result.class == ::ActiveRecord::NamedScope::Scope # is_a? doesn't work
            when :relation
              defined?(::ActiveRecord::Relation) && @result.is_a?(::ActiveRecord::Relation)
            when :association
              @result.respond_to?(:proxy_reflection) || @result.respond_to?(:proxy_association)
            end
          end
        end

        if !AridCache.framework.active_record?
          false
        elsif options[:receiver_is_a_class]
          result_is_a.call(:scope, :association, :relation)
        else
          result_is_a.call(:association, :scope, :relation)
        end
      end
# In Rails 2.3 scopes (e.g. User.companies) are loaded if you call anything but
# respond_to? on them.  Associations (e.g. User.first.companies) are loaded if
# you call anything but class on them.  So it's almost impossible to detect without
# loading.
In Rails 2.3 scopes  are loaded if you call anything but
respond_to. on them.  Associations  are loaded if
you call anything but class on them.  So it's almost impossible to detect without
loading.
In Rails 2 . 3 scopes are loaded if you call anything but respond_to . on them . Associations are loaded if you call anything but class on them . So it ' s almost impossible to detect without loading .
def is_activerecord_reflection?
        result_is_a = lambda do |*types|
          !!types.find do |type|
            case type
            when :scope
              defined?(::ActiveRecord::NamedScope::Scope) && @result.class == ::ActiveRecord::NamedScope::Scope 
            when :relation
              defined?(::ActiveRecord::Relation) && @result.is_a?(::ActiveRecord::Relation)
            when :association
              @result.respond_to?(:proxy_reflection) || @result.respond_to?(:proxy_association)
            end
          end
        end
        if !AridCache.framework.active_record?
          false
        elsif options[:receiver_is_a_class]
          result_is_a.call(:scope, :association, :relation)
        else
          result_is_a.call(:association, :scope, :relation)
        end
      end
def is_activerecord_reflection? result_is_a = lambda do | * types | ! ! types . find do | type | case type when :scope defined? ( :: ActiveRecord :: NamedScope :: Scope ) && @result . class == :: ActiveRecord :: NamedScope :: Scope when :relation defined? ( :: ActiveRecord :: Relation ) && @result . is_a? ( :: ActiveRecord :: Relation ) when :association @result . respond_to? ( :proxy_reflection ) || @result . respond_to? ( :proxy_association ) end end end if ! AridCache . framework . active_record? false elsif options [ :receiver_is_a_class ] result_is_a . call ( :scope , :association , :relation ) else result_is_a . call ( :association , :scope , :relation ) end end
In Rails 2.3 scopes (e.g.
In Rails 2 . 3 scopes ( e . g .
# is_a? doesn't work