aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r--activerecord/lib/active_record/associations/collection_proxy.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations/collection_proxy.rb b/activerecord/lib/active_record/associations/collection_proxy.rb
index e73f940334..536e108f0e 100644
--- a/activerecord/lib/active_record/associations/collection_proxy.rb
+++ b/activerecord/lib/active_record/associations/collection_proxy.rb
@@ -835,8 +835,9 @@ module ActiveRecord
# Returns a <tt>Relation</tt> object for the records in this association
def scope
association = @association
-
- @association.scope.extending! do
+ scope = @association.scope
+ scope.none! if @association.owner.new_record?
+ scope.extending! do
define_method(:proxy_association) { association }
end
end