From 00f1cd71a97bfa79e6b62a870b09ca914c48e421 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Thu, 8 Jul 2010 13:58:23 +0200 Subject: fix ActiveRecord `destroy_all` so it returns destroyed records Signed-off-by: Jeremy Kemper --- .../lib/active_record/associations/association_collection.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'activerecord/lib/active_record/associations') diff --git a/activerecord/lib/active_record/associations/association_collection.rb b/activerecord/lib/active_record/associations/association_collection.rb index a4e08c7d41..615b7d2719 100644 --- a/activerecord/lib/active_record/associations/association_collection.rb +++ b/activerecord/lib/active_record/associations/association_collection.rb @@ -253,9 +253,10 @@ module ActiveRecord # See destroy for more info. def destroy_all load_target - destroy(@target) - reset_target! - reset_named_scopes_cache! + destroy(@target).tap do + reset_target! + reset_named_scopes_cache! + end end def create(attrs = {}) -- cgit v1.2.3