aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2018-01-11 07:18:35 +0900
committerRyuta Kamizono <kamipo@gmail.com>2018-01-11 07:31:05 +0900
commitae48c65e411e01c1045056562319666384bb1b63 (patch)
tree59560db534e4ea5ec17a3a6a00c3c2c0f8b8a3aa /activerecord/lib/active_record
parentf30f20ccec9edbffc2b80b2d7e839a4fa9ac1eac (diff)
parenteebcebdeb58ff7b6c05cb1cfbbc9aa4c85c9800e (diff)
downloadrails-ae48c65e411e01c1045056562319666384bb1b63.tar.gz
rails-ae48c65e411e01c1045056562319666384bb1b63.tar.bz2
rails-ae48c65e411e01c1045056562319666384bb1b63.zip
Merge pull request #23146 from piotrj/issue_18424
When deleting through records, take into account association conditions
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/associations/has_many_through_association.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/associations/has_many_through_association.rb b/activerecord/lib/active_record/associations/has_many_through_association.rb
index ac86911ad8..7a3bef969b 100644
--- a/activerecord/lib/active_record/associations/has_many_through_association.rb
+++ b/activerecord/lib/active_record/associations/has_many_through_association.rb
@@ -140,6 +140,7 @@ module ActiveRecord
scope = through_association.scope
scope.where! construct_join_attributes(*records)
+ scope = scope.where(through_scope_attributes)
case method
when :destroy