Skip to content

Commit 32a5cad

Browse files
committed
Move #proxy_association method to AssociationRelation
1 parent 1b02299 commit 32a5cad

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

activerecord/lib/active_record/association_relation.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ def initialize(klass, table, association)
55
@association = association
66
end
77

8+
def proxy_association
9+
@association
10+
end
11+
812
private
913

1014
def exec_queries

activerecord/lib/active_record/associations/collection_proxy.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -847,9 +847,7 @@ def scoping
847847

848848
# Returns a <tt>Relation</tt> object for the records in this association
849849
def scope
850-
@association.scope.tap do |scope|
851-
scope.proxy_association = @association
852-
end
850+
@association.scope
853851
end
854852

855853
# :nodoc:

activerecord/lib/active_record/relation.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Relation
1717
include FinderMethods, Calculations, SpawnMethods, QueryMethods, Batches, Explain, Delegation
1818

1919
attr_reader :table, :klass, :loaded
20-
attr_accessor :default_scoped, :proxy_association
20+
attr_accessor :default_scoped
2121
alias :model :klass
2222
alias :loaded? :loaded
2323
alias :default_scoped? :default_scoped

0 commit comments

Comments
 (0)