diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2014-11-08 11:24:52 -0200 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2014-11-08 11:24:52 -0200 |
commit | a153fae6d9549961a81d0e43364c2b970b42730b (patch) | |
tree | df9f6893d1fce9bdb44ad566209e06c9d0ac9aaf /activerecord/lib/active_record/associations/singular_association.rb | |
parent | f8f02f4f6d73fd514d499063cceeaadbd823f273 (diff) | |
parent | 9bd43868502f5e8a67649ffb5e766853a05714c5 (diff) | |
download | rails-a153fae6d9549961a81d0e43364c2b970b42730b.tar.gz rails-a153fae6d9549961a81d0e43364c2b970b42730b.tar.bz2 rails-a153fae6d9549961a81d0e43364c2b970b42730b.zip |
Merge pull request #17559 from alfa-jpn/fix/singular_association_cache
default scopes should break the cache on singulur_association.
Diffstat (limited to 'activerecord/lib/active_record/associations/singular_association.rb')
-rw-r--r-- | activerecord/lib/active_record/associations/singular_association.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/singular_association.rb b/activerecord/lib/active_record/associations/singular_association.rb index c360ef1b2c..c44242a0f0 100644 --- a/activerecord/lib/active_record/associations/singular_association.rb +++ b/activerecord/lib/active_record/associations/singular_association.rb @@ -41,7 +41,8 @@ module ActiveRecord def get_records if reflection.scope_chain.any?(&:any?) || scope.eager_loading? || - klass.current_scope + klass.current_scope || + klass.default_scopes.any? return scope.limit(1).to_a end |