diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-09-04 03:51:24 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2017-09-04 03:51:24 +0900 |
commit | 925e6d561ae8847777e57f6a0bacc930d35bf05b (patch) | |
tree | 9bcbeb237f9593dd352172dbcc6350ac300851ee /activerecord/test/models | |
parent | 6a099b168216db45be2d95aa51eac62100b62058 (diff) | |
download | rails-925e6d561ae8847777e57f6a0bacc930d35bf05b.tar.gz rails-925e6d561ae8847777e57f6a0bacc930d35bf05b.tar.bz2 rails-925e6d561ae8847777e57f6a0bacc930d35bf05b.zip |
Scope in associations should treat nil as `all`
Defined scope treats nil as `all`, but scope in associations isn't so.
If the result of the scope is nil, most features on associations will be
broken. It should treat nil as `all` like defined scope.
Fixes #20823.
Diffstat (limited to 'activerecord/test/models')
-rw-r--r-- | activerecord/test/models/author.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/test/models/author.rb b/activerecord/test/models/author.rb index 025d013fb4..0a52cc5390 100644 --- a/activerecord/test/models/author.rb +++ b/activerecord/test/models/author.rb @@ -78,7 +78,7 @@ class Author < ActiveRecord::Base after_add: [:log_after_adding, Proc.new { |o, r| o.post_log << "after_adding_proc#{r.id || '<new>'}" }] has_many :unchangeable_posts, class_name: "Post", before_add: :raise_exception, after_add: :log_after_adding - has_many :categorizations + has_many :categorizations, -> {} has_many :categories, through: :categorizations has_many :named_categories, through: :categorizations |