aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2018-01-07 23:18:54 +0900
committerRyuta Kamizono <kamipo@gmail.com>2018-01-07 23:22:20 +0900
commit455456437ce2b96fdc632febc742fc4c25ae126d (patch)
tree8162417c934341dd09ba92eea123b16f238a4fd9 /activerecord
parent1223782598ecfe7bcd68de094bf447724b9d92c0 (diff)
downloadrails-455456437ce2b96fdc632febc742fc4c25ae126d.tar.gz
rails-455456437ce2b96fdc632febc742fc4c25ae126d.tar.bz2
rails-455456437ce2b96fdc632febc742fc4c25ae126d.zip
Simply use `scope.delete_all` instead of constructing delete manager
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/associations/has_many_through_association.rb9
1 files changed, 1 insertions, 8 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 adbf52b87c..ac86911ad8 100644
--- a/activerecord/lib/active_record/associations/has_many_through_association.rb
+++ b/activerecord/lib/active_record/associations/has_many_through_association.rb
@@ -147,14 +147,7 @@ module ActiveRecord
count = scope.destroy_all.length
else
scope.each(&:_run_destroy_callbacks)
-
- arel = scope.arel
-
- stmt = Arel::DeleteManager.new
- stmt.from scope.klass.arel_table
- stmt.wheres = arel.constraints
-
- count = scope.klass.connection.delete(stmt, "SQL")
+ count = scope.delete_all
end
when :nullify
count = scope.update_all(source_reflection.foreign_key => nil)