diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-08-15 21:39:40 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2017-08-15 21:41:54 +0900 |
commit | 56b870f243c1a73a1d15638500e5aa5e7ae9a1cc (patch) | |
tree | 20cfa559644eafcbdf42c0dc8a05065fa92525e4 /activerecord/lib/active_record/associations/preloader/association.rb | |
parent | fbeebded22f53337df339285164352f298639c63 (diff) | |
download | rails-56b870f243c1a73a1d15638500e5aa5e7ae9a1cc.tar.gz rails-56b870f243c1a73a1d15638500e5aa5e7ae9a1cc.tar.bz2 rails-56b870f243c1a73a1d15638500e5aa5e7ae9a1cc.zip |
Through scope should not be affected by scoping
Follow up of #29834.
Fixes #30266.
Diffstat (limited to 'activerecord/lib/active_record/associations/preloader/association.rb')
-rw-r--r-- | activerecord/lib/active_record/associations/preloader/association.rb | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/activerecord/lib/active_record/associations/preloader/association.rb b/activerecord/lib/active_record/associations/preloader/association.rb index 5ba03c555a..4915a37f06 100644 --- a/activerecord/lib/active_record/associations/preloader/association.rb +++ b/activerecord/lib/active_record/associations/preloader/association.rb @@ -116,18 +116,8 @@ module ActiveRecord @reflection_scope ||= reflection.scope_for(klass) end - def klass_scope - current_scope = klass.current_scope - - if current_scope && current_scope.empty_scope? - klass.unscoped - else - klass.default_scoped - end - end - def build_scope - scope = klass_scope + scope = klass.scope_for_association if reflection.type scope.where!(reflection.type => model.base_class.sti_name) |