Class: ActiveRecord::Associations::AssociationScope
- Inherits:
-
Object
- Object
- ActiveRecord::Associations::AssociationScope
- Includes:
- JoinHelper
- Defined in:
- lib/active_record/associations/association_scope.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#alias_tracker ⇒ Object
readonly
Returns the value of attribute alias_tracker.
-
#association ⇒ Object
readonly
Returns the value of attribute association.
Instance Method Summary collapse
-
#initialize(association) ⇒ AssociationScope
constructor
A new instance of AssociationScope.
- #scope ⇒ Object
Methods included from JoinHelper
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_tracker ⇒ Object (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 |
#association ⇒ Object (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
#scope ⇒ Object
16 17 18 19 20 |
# File 'lib/active_record/associations/association_scope.rb', line 16 def scope scope = klass.unscoped scope.extending! Array([:extend]) add_constraints(scope) end |