aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2014-12-29 11:55:50 -0700
committerSean Griffin <sean@thoughtbot.com>2014-12-29 11:56:37 -0700
commitfb14aa0c1b6ced78331899d916607e1da015e164 (patch)
tree5f25d26fc099bdcec4d4f20f5668f9013b6a1897 /activerecord/test
parent2223f491576f8f2c1c38fa5acbbe62dc9d715c75 (diff)
downloadrails-fb14aa0c1b6ced78331899d916607e1da015e164.tar.gz
rails-fb14aa0c1b6ced78331899d916607e1da015e164.tar.bz2
rails-fb14aa0c1b6ced78331899d916607e1da015e164.zip
Ensure `first!` and friends work on loaded associations
Fixes #18237
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/associations_test.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations_test.rb b/activerecord/test/cases/associations_test.rb
index c6769edcbf..72963fd56c 100644
--- a/activerecord/test/cases/associations_test.rb
+++ b/activerecord/test/cases/associations_test.rb
@@ -264,6 +264,11 @@ class AssociationProxyTest < ActiveRecord::TestCase
end
end
+ test "first! works on loaded associations" do
+ david = authors(:david)
+ assert_equal david.posts.first, david.posts.reload.first!
+ end
+
def test_reset_unloads_target
david = authors(:david)
david.posts.reload