class ThinkingSphinx::ActiveRecord::Depolymorph::ScopedReflection

This scoped approach is only available in Rails 4.0. This behaviour is superseded by AssociationReflection for Rails 4.1, and was preceded by ConditionsReflection for Rails 3.2.

Public Instance Methods

call() click to toggle source
# File lib/thinking_sphinx/active_record/depolymorph/scoped_reflection.rb, line 9
def call
  klass.new reflection.macro, name, scope, options,
    reflection.active_record
end

Private Instance Methods

scope() click to toggle source
# File lib/thinking_sphinx/active_record/depolymorph/scoped_reflection.rb, line 16
def scope
  lambda { |association|
    reflection = association.reflection
    klass      = reflection.class_name.constantize
    where(
      association.parent.aliased_table_name.to_sym =>
      {reflection.foreign_type => klass.base_class.name}
    )
  }
end