aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2019-02-26 18:07:13 -0500
committerRafael Mendonça França <rafaelmfranca@gmail.com>2019-02-26 18:07:13 -0500
commit572dcdd7e858f126848bdf4f2be0f5cb0de7c026 (patch)
treeb0bad61734f2ded9782bf51cd701bffb1a6e56d9 /activerecord/test/models
parent196e22de5378cf684760f082c8131f728f4717c4 (diff)
downloadrails-572dcdd7e858f126848bdf4f2be0f5cb0de7c026.tar.gz
rails-572dcdd7e858f126848bdf4f2be0f5cb0de7c026.tar.bz2
rails-572dcdd7e858f126848bdf4f2be0f5cb0de7c026.zip
Fix preload with nested associations
When the middle association doesn't have any records and the inner association is not an empty scope the owner will be `nil` so we can't try to reset the inverse association.
Diffstat (limited to 'activerecord/test/models')
-rw-r--r--activerecord/test/models/author.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/activerecord/test/models/author.rb b/activerecord/test/models/author.rb
index 8b5a2fa0c8..3eb8a3a0fa 100644
--- a/activerecord/test/models/author.rb
+++ b/activerecord/test/models/author.rb
@@ -217,6 +217,8 @@ class AuthorAddress < ActiveRecord::Base
end
class AuthorFavorite < ActiveRecord::Base
+ default_scope { order(id: :asc) }
+
belongs_to :author
belongs_to :favorite_author, class_name: "Author"
end