Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

delete_all raise an error if a limit is provided - fixes #4979 #6089

Merged
merged 1 commit into from

4 participants

@frodsan

No description provided.

@tenderlove tenderlove was assigned
@tenderlove tenderlove merged commit 7d2df5f into from
@frodsan

@carlosantoniodasilva this should be backported to 3-2 too? I'm not sure, this was my first commit merged.

@rafaelfranca
Owner
@frodsan

@rafaelfranca @tenderlove ok, done. thanks!

@frodsan frodsan deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
2  activerecord/lib/active_record/relation.rb
@@ -390,6 +390,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
+
if conditions
where(conditions).delete_all
else
View
4 activerecord/test/cases/relations_test.rb
@@ -688,6 +688,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
Something went wrong with that request. Please try again.