1
0
Fork 0
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:
Eugene Kenny 2021-05-18 11:47:42 +01:00 committed by GitHub
commit e44927fea9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View file

@ -56,8 +56,8 @@ module ActiveRecord
end
private
def exec_queries
@records = [].freeze
def exec_main_query(async: false)
[].freeze
end
end
end

View file

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