aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2014-12-11 14:54:03 -0700
committerSean Griffin <sean@thoughtbot.com>2014-12-11 14:54:03 -0700
commit6cb956592cc5deb5496729f1e09ca9a4cc22868c (patch)
tree61d3f69be2080c69c351b72ae3b70a57141e32fc /activerecord
parent39542fba54328ca048fb75a5d5b37f8e1d4c1f37 (diff)
downloadrails-6cb956592cc5deb5496729f1e09ca9a4cc22868c.tar.gz
rails-6cb956592cc5deb5496729f1e09ca9a4cc22868c.tar.bz2
rails-6cb956592cc5deb5496729f1e09ca9a4cc22868c.zip
Add test case for joined pluck
https://github.com/rails/rails/commit/39542fba54328ca048fb75a5d5b37f8e1d4c1f37#commitcomment-8938379
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/test/cases/calculations_test.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/test/cases/calculations_test.rb b/activerecord/test/cases/calculations_test.rb
index 6cf18bc3c6..299217214e 100644
--- a/activerecord/test/cases/calculations_test.rb
+++ b/activerecord/test/cases/calculations_test.rb
@@ -618,6 +618,13 @@ class CalculationsTest < ActiveRecord::TestCase
assert_equal part.id, ShipPart.joins(:trinkets).sum(:id)
end
+ def test_pluck_joined_with_polymorphic_relation
+ part = ShipPart.create!(name: "has trinket")
+ part.trinkets.create!
+
+ assert_equal [part.id], ShipPart.joins(:trinkets).pluck(:id)
+ end
+
def test_grouped_calculation_with_polymorphic_relation
part = ShipPart.create!(name: "has trinket")
part.trinkets.create!