diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-04-11 15:47:36 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-04-11 15:48:11 -0300 |
commit | c8a70660d46343d05c954c8a9b830166aa7335e9 (patch) | |
tree | a1910daaec4c5be938d71d16ccf508bab5bd8813 /activerecord/test | |
parent | 7bb8fd2f641c3416522e647ed32a3142ccc1e01b (diff) | |
parent | 8d11fbf679e17c277ddf5bf52311f0e824ebae46 (diff) | |
download | rails-c8a70660d46343d05c954c8a9b830166aa7335e9.tar.gz rails-c8a70660d46343d05c954c8a9b830166aa7335e9.tar.bz2 rails-c8a70660d46343d05c954c8a9b830166aa7335e9.zip |
Merge branch 'rm-fix-13648'
Includes https://github.com/rails/rails/pull/14711 and some cleanup
commits.
Fixes #13648
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/associations/eager_test.rb | 8 | ||||
-rw-r--r-- | activerecord/test/cases/relations_test.rb | 10 |
2 files changed, 18 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/eager_test.rb b/activerecord/test/cases/associations/eager_test.rb index 8c9797861c..7eaa5adc86 100644 --- a/activerecord/test/cases/associations/eager_test.rb +++ b/activerecord/test/cases/associations/eager_test.rb @@ -1198,6 +1198,14 @@ class EagerAssociationTest < ActiveRecord::TestCase assert_equal authors(:bob), author end + test "preloading with a polymorphic association and using the existential predicate but also using a select" do + assert_equal authors(:david), authors(:david).essays.includes(:writer).first.writer + + assert_nothing_raised do + authors(:david).essays.includes(:writer).select(:name).any? + end + end + test "preloading with a polymorphic association and using the existential predicate" do assert_equal authors(:david), authors(:david).essays.includes(:writer).first.writer diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 2aa6d643a5..562cfe6796 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -824,6 +824,16 @@ class RelationTest < ActiveRecord::TestCase assert_raises(ActiveRecord::ActiveRecordError) { Author.limit(10).delete_all } end + def test_select_with_aggregates + posts = Post.select(:title, :body) + + assert_equal 11, posts.count(:all) + assert_equal 11, posts.size + assert posts.any? + assert posts.many? + assert_not posts.empty? + end + def test_select_takes_a_variable_list_of_args david = developers(:david) |