diff options
author | Sean Griffin <sean@seantheprogrammer.com> | 2017-07-18 13:11:01 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-18 13:11:01 -0400 |
commit | 41d51b07160484b616e48658ddb76d1d1d13a6c0 (patch) | |
tree | 8667114fb9c227ad1459782f8405583828040a2f /activerecord/lib/active_record/reflection.rb | |
parent | 8ebe1f2feed30809abb3f114242dda7379e66e4b (diff) | |
parent | 9aa04315febfb37b50f52471a2837c40313a2d5f (diff) | |
download | rails-41d51b07160484b616e48658ddb76d1d1d13a6c0.tar.gz rails-41d51b07160484b616e48658ddb76d1d1d13a6c0.tar.bz2 rails-41d51b07160484b616e48658ddb76d1d1d13a6c0.zip |
Merge pull request #29834 from kamipo/fix_unscoping_default_scope_with_sti_association
Fix unscoping `default_scope` in STI associations
Diffstat (limited to 'activerecord/lib/active_record/reflection.rb')
-rw-r--r-- | activerecord/lib/active_record/reflection.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb index 4f53280b5c..1026e20f79 100644 --- a/activerecord/lib/active_record/reflection.rb +++ b/activerecord/lib/active_record/reflection.rb @@ -219,8 +219,10 @@ module ActiveRecord end def klass_join_scope(table, predicate_builder) # :nodoc: - if klass.current_scope && klass.current_scope.values.empty? - klass.unscoped + current_scope = klass.current_scope + + if current_scope && current_scope.empty_scope? + build_scope(table, predicate_builder) else klass.default_scoped(build_scope(table, predicate_builder)) end |