diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2009-12-29 11:45:25 +0530 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2009-12-29 11:46:07 +0530 |
commit | 13989ff8c690b9b9e5282bd4098666c909ea64d3 (patch) | |
tree | 15e6e03709e179b1b8f5b02f60b4e701bce5f9c9 /activerecord/lib/active_record/base.rb | |
parent | 54b80c73611fe8eb19039381bf0322326f5e1b51 (diff) | |
download | rails-13989ff8c690b9b9e5282bd4098666c909ea64d3.tar.gz rails-13989ff8c690b9b9e5282bd4098666c909ea64d3.tar.bz2 rails-13989ff8c690b9b9e5282bd4098666c909ea64d3.zip |
Use relation#delete_all for Model.delete_all
Diffstat (limited to 'activerecord/lib/active_record/base.rb')
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 53f0a920a3..6715871bf9 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -939,11 +939,7 @@ module ActiveRecord #:nodoc: # Both calls delete the affected posts all at once with a single DELETE statement. If you need to destroy dependent # associations or call your <tt>before_*</tt> or +after_destroy+ callbacks, use the +destroy_all+ method instead. def delete_all(conditions = nil) - if conditions - arel_table.where(Arel::SqlLiteral.new(construct_conditions(conditions, scope(:find)))).delete - else - arel_table.delete - end + arel_table.where(construct_conditions(conditions, scope(:find))).delete_all end # Returns the result of an SQL statement that should only include a COUNT(*) in the SELECT part. |