diff --git a/activerecord/lib/active_record/future_result.rb b/activerecord/lib/active_record/future_result.rb index fdb778aa68..f55473ff2c 100644 --- a/activerecord/lib/active_record/future_result.rb +++ b/activerecord/lib/active_record/future_result.rb @@ -60,7 +60,6 @@ def self.wrap(result) end delegate :empty?, :to_a, to: :result - delegate_missing_to :result attr_reader :lock_wait diff --git a/activerecord/test/cases/relation/load_async_test.rb b/activerecord/test/cases/relation/load_async_test.rb index 5be5b02568..99eccfd173 100644 --- a/activerecord/test/cases/relation/load_async_test.rb +++ b/activerecord/test/cases/relation/load_async_test.rb @@ -217,6 +217,11 @@ def test_pluck assert_equal titles, Post.where(author_id: 1).load_async.pluck(:title) end + def test_count + count = Post.where(author_id: 1).count + assert_equal count, Post.where(author_id: 1).load_async.count + end + def test_size expected_size = Post.where(author_id: 1).size @@ -233,12 +238,19 @@ def test_empty? assert_predicate deferred_posts, :loaded? end - def test_load_async_with_query_cache + def test_load_async_pluck_with_query_cache titles = Post.where(author_id: 1).pluck(:title) Post.cache do assert_equal titles, Post.where(author_id: 1).load_async.pluck(:title) end end + + def test_load_async_count_with_query_cache + count = Post.where(author_id: 1).count + Post.cache do + assert_equal count, Post.where(author_id: 1).load_async.count + end + end end class LoadAsyncNullExecutorTest < ActiveRecord::TestCase