Class: ActiveRecord::Associations::AssociationScope

Inherits:
Object
  • Object
show all
Defined in:
activerecord/lib/active_record/associations/association_scope.rb

Overview

:nodoc:

Constant Summary collapse

INSTANCE =
new

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.scope(association, connection) ⇒ Object



6
7
8
# File 'activerecord/lib/active_record/associations/association_scope.rb', line 6

def self.scope(association, connection)
  INSTANCE.scope association, connection
end

Instance Method Details

#join_typeObject



21
22
23
# File 'activerecord/lib/active_record/associations/association_scope.rb', line 21

def join_type
  Arel::Nodes::InnerJoin
end

#scope(association, connection) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'activerecord/lib/active_record/associations/association_scope.rb', line 10

def scope(association, connection)
  klass         = association.klass
  reflection    = association.reflection
  scope         = klass.unscoped
  owner         = association.owner
  alias_tracker = AliasTracker.empty connection

  scope.extending! Array(reflection.options[:extend])
  add_constraints(scope, owner, klass, reflection, alias_tracker)
end