mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #42242 from eugeneius/async_query_on_null_relation
Avoid running async queries on null relations
This commit is contained in:
commit
e44927fea9
2 changed files with 8 additions and 2 deletions
|
@ -56,8 +56,8 @@ module ActiveRecord
|
|||
end
|
||||
|
||||
private
|
||||
def exec_queries
|
||||
@records = [].freeze
|
||||
def exec_main_query(async: false)
|
||||
[].freeze
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -28,6 +28,12 @@ class NullRelationTest < ActiveRecord::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
def test_async_query_on_null_relation
|
||||
assert_no_queries do
|
||||
assert_equal [], Developer.none.load_async.load
|
||||
end
|
||||
end
|
||||
|
||||
def test_none_chained_to_methods_firing_queries_straight_to_db
|
||||
assert_no_queries do
|
||||
assert_equal [], Developer.none.pluck(:id, :name)
|
||||
|
|
Loading…
Reference in a new issue