From bbdeaae2cac37882b091474ec596ade3de3b5e7c Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Sun, 27 Dec 2009 19:35:55 +0530 Subject: Add relation.destroy_all --- activerecord/lib/active_record/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib/active_record/base.rb') diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index a3b123c463..cad75f80e5 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -914,7 +914,7 @@ module ActiveRecord #:nodoc: # Person.destroy_all("last_login < '2004-04-04'") # Person.destroy_all(:status => "inactive") def destroy_all(conditions = nil) - where(conditions).each {|object| object.destroy } + where(conditions).destroy_all end # Deletes the records matching +conditions+ without instantiating the records first, and hence not -- cgit v1.2.3