mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Add regression test for https://github.com/rails/rails/pull/40178#issuecomment-688222844
It is a common use case especially for MySQL users.
This commit is contained in:
parent
d04acc0bc5
commit
f7b1582435
1 changed files with 7 additions and 0 deletions
|
@ -33,6 +33,13 @@ class DeleteAllTest < ActiveRecord::TestCase
|
|||
assert_not_predicate davids, :loaded?
|
||||
end
|
||||
|
||||
def test_delete_all_with_index_hint
|
||||
davids = Author.where(name: "David").from("#{Author.quoted_table_name} /*! USE INDEX (PRIMARY) */")
|
||||
|
||||
assert_difference("Author.count", -1) { davids.delete_all }
|
||||
assert_not_predicate davids, :loaded?
|
||||
end
|
||||
|
||||
def test_delete_all_loaded
|
||||
davids = Author.where(name: "David")
|
||||
|
||||
|
|
Loading…
Reference in a new issue