Class: ActiveRecord::Associations::AssociationScope

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

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from JoinHelper

#join_type

Constructor Details

#initialize(association) ⇒ AssociationScope

Returns a new instance of AssociationScope.



11
12
13
14
# File 'lib/active_record/associations/association_scope.rb', line 11

def initialize(association)
  @association   = association
  @alias_tracker = AliasTracker.new klass.connection
end

Instance Attribute Details

#alias_trackerObject (readonly)

Returns the value of attribute alias_tracker.



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

def alias_tracker
  @alias_tracker
end

#associationObject (readonly)

Returns the value of attribute association.



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

def association
  @association
end

Instance Method Details

#scopeObject



16
17
18
19
20
# File 'lib/active_record/associations/association_scope.rb', line 16

def scope
  scope = klass.unscoped
  scope.extending! Array(options[:extend])
  add_constraints(scope)
end