diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2009-12-29 11:36:40 +0530 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2009-12-29 11:46:07 +0530 |
commit | 54b80c73611fe8eb19039381bf0322326f5e1b51 (patch) | |
tree | 701a8e76da825bc839cf0cde241c4ff994633273 /activerecord/lib | |
parent | f79caa49fb78bca986a4321830c4cd155c17e13a (diff) | |
download | rails-54b80c73611fe8eb19039381bf0322326f5e1b51.tar.gz rails-54b80c73611fe8eb19039381bf0322326f5e1b51.tar.bz2 rails-54b80c73611fe8eb19039381bf0322326f5e1b51.zip |
Add Relation#delete_all
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/relation.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index e495aa80db..a3d7be3afe 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -134,6 +134,7 @@ module ActiveRecord if [String, Hash, Array].include?(args.first.class) conditions = @klass.send(:merge_conditions, args.size > 1 ? Array.wrap(args) : args.first) + conditions = Arel::SqlLiteral.new(conditions) if conditions else conditions = args.first end @@ -223,6 +224,11 @@ module ActiveRecord reset end + def delete_all + @relation.delete + reset + end + def loaded? @loaded end |