diff --git a/activerecord/lib/active_record/null_relation.rb b/activerecord/lib/active_record/null_relation.rb index 00772bf1ec..ff177fb386 100644 --- a/activerecord/lib/active_record/null_relation.rb +++ b/activerecord/lib/active_record/null_relation.rb @@ -56,8 +56,8 @@ module ActiveRecord end private - def exec_queries - @records = [].freeze + def exec_main_query(async: false) + [].freeze end end end diff --git a/activerecord/test/cases/null_relation_test.rb b/activerecord/test/cases/null_relation_test.rb index ef593497f3..a3d0e9cf4e 100644 --- a/activerecord/test/cases/null_relation_test.rb +++ b/activerecord/test/cases/null_relation_test.rb @@ -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)