aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2017-03-20 19:32:07 +0100
committerGitHub <noreply@github.com>2017-03-20 19:32:07 +0100
commitdd40c770532f48bb3a4e607ee9d8497aef533a74 (patch)
tree1af58bf5ed7db4b149486283689d73bd06111dfa /activerecord/lib/active_record
parenteeb8c3c246bd0c8bbf95b555efcec9fcb19cc3c6 (diff)
parent1385a8b5ff81adc3dfa5dc6ad88ce00b28e95ce1 (diff)
downloadrails-dd40c770532f48bb3a4e607ee9d8497aef533a74.tar.gz
rails-dd40c770532f48bb3a4e607ee9d8497aef533a74.tar.bz2
rails-dd40c770532f48bb3a4e607ee9d8497aef533a74.zip
Merge pull request #28474 from kamipo/fix_extension_with_darty_target
Fix extension method with dirty target in has_many associations
Diffstat (limited to 'activerecord/lib/active_record')
-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 bc2f359c65..3c44296d8c 100644
--- a/activerecord/lib/active_record/associations/collection_proxy.rb
+++ b/activerecord/lib/active_record/associations/collection_proxy.rb
@@ -1154,8 +1154,9 @@ module ActiveRecord
end
def method_missing(method, *args, &block)
- if scope.respond_to?(method)
- scope.public_send(method, *args, &block)
+ if scope.respond_to?(method) && scope.extending_values.any?
+ extend(*scope.extending_values)
+ public_send(method, *args, &block)
else
super
end