Skip to content
Browse files

Merge pull request #6128 from frodsan/delete_all_limit_32

Fix #4979 against 3-2-stable
  • Loading branch information...
2 parents efb054b + 4657dba commit 80a292cbd9d32ed87333b58b36618cfda8d4b95a @tenderlove tenderlove committed
Showing with 6 additions and 0 deletions.
  1. +2 −0 activerecord/lib/active_record/relation.rb
  2. +4 −0 activerecord/test/cases/relations_test.rb
View
2 activerecord/lib/active_record/relation.rb
@@ -403,6 +403,8 @@ def destroy(id)
# 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)
+ raise ActiveRecordError.new("delete_all doesn't support limit scope") if self.limit_value
+
IdentityMap.repository[symbolized_base_class] = {} if IdentityMap.enabled?
if conditions
where(conditions).delete_all
View
4 activerecord/test/cases/relations_test.rb
@@ -643,6 +643,10 @@ def test_delete_all_loaded
assert davids.loaded?
end
+ def test_delete_all_limit_error
+ assert_raises(ActiveRecord::ActiveRecordError) { Author.limit(10).delete_all }
+ end
+
def test_select_argument_error
assert_raises(ArgumentError) { Developer.select }
end

0 comments on commit 80a292c

Please sign in to comment.
Something went wrong with that request. Please try again.