aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/batches_test.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/activerecord/test/cases/batches_test.rb b/activerecord/test/cases/batches_test.rb
index 53c1e61ad1..c965404b07 100644
--- a/activerecord/test/cases/batches_test.rb
+++ b/activerecord/test/cases/batches_test.rb
@@ -614,6 +614,17 @@ class EachTest < ActiveRecord::TestCase
assert_equal expected, actual
end
+ test ".find_each respects table alias" do
+ assert_queries(1) do
+ table_alias = Post.arel_table.alias("omg_posts")
+ table_metadata = ActiveRecord::TableMetadata.new(Post, table_alias)
+ predicate_builder = ActiveRecord::PredicateBuilder.new(table_metadata)
+
+ posts = ActiveRecord::Relation.create(Post, table_alias, predicate_builder)
+ posts.find_each {}
+ end
+ end
+
test ".find_each bypasses the query cache for its own queries" do
Post.cache do
assert_queries(2) do