diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2018-12-04 15:48:22 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2018-12-04 15:48:22 +0900 |
commit | 609c58bfa6df58b88e3eadebb1f1d49354541d24 (patch) | |
tree | b32f657ab6d175aa9def9db12c960180c9121a7a /activerecord/lib/active_record | |
parent | 53d5a682c90b20a35cfc44d4f0e267ee94321e8f (diff) | |
parent | 4d7354aa352b94ec3a10ad053cff04890c534080 (diff) | |
download | rails-609c58bfa6df58b88e3eadebb1f1d49354541d24.tar.gz rails-609c58bfa6df58b88e3eadebb1f1d49354541d24.tar.bz2 rails-609c58bfa6df58b88e3eadebb1f1d49354541d24.zip |
Merge pull request #34609 from kamipo/delete_all_on_collection_proxy
Ensure that `delete_all` on collection proxy returns affected count
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/associations/has_many_association.rb | 1 | ||||
-rw-r--r-- | activerecord/lib/active_record/associations/has_many_through_association.rb | 2 |
2 files changed, 3 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/associations/has_many_association.rb b/activerecord/lib/active_record/associations/has_many_association.rb index e224d3456a..f6fdbcde54 100644 --- a/activerecord/lib/active_record/associations/has_many_association.rb +++ b/activerecord/lib/active_record/associations/has_many_association.rb @@ -99,6 +99,7 @@ module ActiveRecord def delete_or_nullify_all_records(method) count = delete_count(method, scope) update_counter(-count) + count end # Deletes the records according to the <tt>:dependent</tt> option. 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 2322a49931..84a9797aa5 100644 --- a/activerecord/lib/active_record/associations/has_many_through_association.rb +++ b/activerecord/lib/active_record/associations/has_many_through_association.rb @@ -161,6 +161,8 @@ module ActiveRecord else update_counter(-count) end + + count end def difference(a, b) |