Class: ActiveRecord::Associations::DisableJoinsAssociationScope

Inherits:
AssociationScope show all
Defined in:
activerecord/lib/active_record/associations/disable_joins_association_scope.rb

Overview

:nodoc:

Constant Summary

Constants inherited from AssociationScope

AssociationScope::INSTANCE

Instance Method Summary collapse

Methods inherited from AssociationScope

create, get_bind_values, #initialize, scope

Constructor Details

This class inherits a constructor from ActiveRecord::Associations::AssociationScope

Instance Method Details

#scope(association) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'activerecord/lib/active_record/associations/disable_joins_association_scope.rb', line 6

def scope(association)
  source_reflection = association.reflection
  owner = association.owner
  unscoped = association.klass.unscoped
  reverse_chain = get_chain(source_reflection, association, unscoped.alias_tracker).reverse

  last_reflection, last_ordered, last_join_ids = last_scope_chain(reverse_chain, owner)

  add_constraints(last_reflection, last_reflection.join_primary_key, last_join_ids, owner, last_ordered)
end