1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
It is a common use case especially for MySQL users.
This commit is contained in:
Ryuta Kamizono 2020-09-09 19:26:57 +09:00
parent d04acc0bc5
commit f7b1582435

View file

@ -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")