aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations/eager_test.rb
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2016-06-13 11:03:38 -0400
committerGitHub <noreply@github.com>2016-06-13 11:03:38 -0400
commit1efc81ba8fe27e406bdb2de104234253b47ddc2f (patch)
tree6f376f8d6a19a594c7c3c1381cc465e909c4db8d /activerecord/test/cases/associations/eager_test.rb
parent1f131fba4cf9497ee0c54bb4a51fd86ec76b76a4 (diff)
parent681a0a0299500024635e790c1ceb2da281652444 (diff)
downloadrails-1efc81ba8fe27e406bdb2de104234253b47ddc2f.tar.gz
rails-1efc81ba8fe27e406bdb2de104234253b47ddc2f.tar.bz2
rails-1efc81ba8fe27e406bdb2de104234253b47ddc2f.zip
Merge pull request #25374 from kamipo/fix_calculate_with_string_in_from_and_eager_loading
Fix `calculate` with a string value in `from` and eager loading
Diffstat (limited to 'activerecord/test/cases/associations/eager_test.rb')
-rw-r--r--activerecord/test/cases/associations/eager_test.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/eager_test.rb b/activerecord/test/cases/associations/eager_test.rb
index f7bb3e54d5..80d9a6083b 100644
--- a/activerecord/test/cases/associations/eager_test.rb
+++ b/activerecord/test/cases/associations/eager_test.rb
@@ -90,6 +90,10 @@ class EagerAssociationTest < ActiveRecord::TestCase
assert_no_queries { authors.map(&:post) }
end
+ def test_calculate_with_string_in_from_and_eager_loading
+ assert_equal 10, Post.from("authors, posts").eager_load(:comments).where("posts.author_id = authors.id").count
+ end
+
def test_with_two_tables_in_from_without_getting_double_quoted
posts = Post.select("posts.*").from("authors, posts").eager_load(:comments).where("posts.author_id = authors.id").order("posts.id").to_a
assert_equal 2, posts.first.comments.size