diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-11-07 16:23:15 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-11-07 16:23:15 -0800 |
commit | c2fc9848b1495768a4c550e4cc532882146902c9 (patch) | |
tree | f08d7a70e32d0b7ff77937d1a4545e1ec0545077 /activerecord/lib/active_record | |
parent | a450cac35e29cd810c8daef698478b99d14b9206 (diff) | |
download | rails-c2fc9848b1495768a4c550e4cc532882146902c9.tar.gz rails-c2fc9848b1495768a4c550e4cc532882146902c9.tar.bz2 rails-c2fc9848b1495768a4c550e4cc532882146902c9.zip |
default scopes should break the cache on has_many.
if you specify a default scope on a model, it will break caching. We
cannot predict what will happen inside the scope, so play it safe for
now. fixes #17495
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/associations/collection_association.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/collection_association.rb b/activerecord/lib/active_record/associations/collection_association.rb index bdfd569be2..4411e5ae62 100644 --- a/activerecord/lib/active_record/associations/collection_association.rb +++ b/activerecord/lib/active_record/associations/collection_association.rb @@ -409,7 +409,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.to_a end |