class ThinkingSphinx::ActiveRecord::Depolymorph::AssociationReflection

This custom association approach is only available in Rails 4.1-5.1. This behaviour is superseded by OverriddenReflection for Rails 5.2, and was preceded by ScopedReflection for Rails 4.0.

Public Instance Methods

call() click to toggle source

Since Rails 4.2, the macro argument has been removed. The underlying behaviour remains the same, though.

# File lib/thinking_sphinx/active_record/depolymorph/association_reflection.rb, line 11
def call
  if explicit_macro?
    klass.new name, nil, options, reflection.active_record
  else
    klass.new reflection.macro, name, nil, options, reflection.active_record
  end
end

Private Instance Methods

explicit_macro?() click to toggle source
# File lib/thinking_sphinx/active_record/depolymorph/association_reflection.rb, line 21
def explicit_macro?
  ActiveRecord::Reflection::MacroReflection.instance_method(:initialize).
    arity == 4
end
options() click to toggle source
# File lib/thinking_sphinx/active_record/depolymorph/association_reflection.rb, line 26
def options
  super

  @options[:sphinx_internal_filtered] = true
  @options
end