diff options
author | Takashi Kokubun <takashikkbn@gmail.com> | 2014-12-20 01:04:47 +0900 |
---|---|---|
committer | Takashi Kokubun <takashikkbn@gmail.com> | 2014-12-30 01:07:33 +0900 |
commit | 068160b444a5ceccd0bdc5dd81b70bc45754bcaa (patch) | |
tree | 9e2737135793c9701516bcafe3bba2e4cdbe47f6 /activerecord/test/cases/associations | |
parent | b67b57d47368b4b834cfe8c58d9e26f5c819c154 (diff) | |
download | rails-068160b444a5ceccd0bdc5dd81b70bc45754bcaa.tar.gz rails-068160b444a5ceccd0bdc5dd81b70bc45754bcaa.tar.bz2 rails-068160b444a5ceccd0bdc5dd81b70bc45754bcaa.zip |
`eager_load` preserves readonly flag for associations
Diffstat (limited to 'activerecord/test/cases/associations')
-rw-r--r-- | activerecord/test/cases/associations/eager_test.rb | 5 |
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 |