Sha256: 3b23d19aa179d293b840ca99d26af53ef6a4a37810597d31510ef960d377536c
Contents?: true
Size: 744 Bytes
Versions: 17
Compression:
Stored size: 744 Bytes
Contents
# frozen_string_literal: true # 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. class ThinkingSphinx::ActiveRecord::Depolymorph::ScopedReflection < ThinkingSphinx::ActiveRecord::Depolymorph::BaseReflection def call klass.new reflection.macro, name, scope, options, reflection.active_record end private 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 end
Version data entries
17 entries across 17 versions & 1 rubygems