aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations/eager_test.rb
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-12-29 14:18:54 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-12-29 14:18:54 -0300
commit266ff700011dfcc4b76a7332bbfa64d9419c10bc (patch)
tree486ddf150e580c3381c5a807a6de94aa5e5abaa8 /activerecord/test/cases/associations/eager_test.rb
parent0906e8322b81c429fddeb89ab08c279719bf29b0 (diff)
parent068160b444a5ceccd0bdc5dd81b70bc45754bcaa (diff)
downloadrails-266ff700011dfcc4b76a7332bbfa64d9419c10bc.tar.gz
rails-266ff700011dfcc4b76a7332bbfa64d9419c10bc.tar.bz2
rails-266ff700011dfcc4b76a7332bbfa64d9419c10bc.zip
Merge pull request #18097 from k0kubun/readonly-eager_load
`eager_load` preserves readonly flag for associations
Diffstat (limited to 'activerecord/test/cases/associations/eager_test.rb')
-rw-r--r--activerecord/test/cases/associations/eager_test.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/activerecord/test/cases/associations/eager_test.rb b/activerecord/test/cases/associations/eager_test.rb
index db8fd92c1f..fdb437d11d 100644
--- a/activerecord/test/cases/associations/eager_test.rb
+++ b/activerecord/test/cases/associations/eager_test.rb
@@ -1328,7 +1328,6 @@ class EagerAssociationTest < ActiveRecord::TestCase
end
test "eager-loading readonly association" do
- skip "eager_load does not yet preserve readonly associations"
# has-one
firm = Firm.where(id: "1").eager_load(:readonly_account).first!
assert firm.readonly_account.readonly?
@@ -1340,6 +1339,10 @@ class EagerAssociationTest < ActiveRecord::TestCase
# has-many :through
david = Author.where(id: "1").eager_load(:readonly_comments).first!
assert david.readonly_comments.first.readonly?
+
+ # belongs_to
+ post = Post.where(id: "1").eager_load(:author).first!
+ assert post.author.readonly?
end
test "preloading a polymorphic association with references to the associated table" do