diff options
author | Ben Woosley <ben.woosley@gmail.com> | 2015-03-12 01:01:07 -0700 |
---|---|---|
committer | Ben Woosley <ben.woosley@gmail.com> | 2015-03-12 01:22:39 -0700 |
commit | c1deb81cd005d7091b680ec2089b9b8dba41325f (patch) | |
tree | afa5e340a77c2ba1592db41c3e79290df9fe6cf0 /activerecord/lib/active_record/associations | |
parent | fd3e63e2d9701f995f56c3dd6dcd30c73bd518b2 (diff) | |
download | rails-c1deb81cd005d7091b680ec2089b9b8dba41325f.tar.gz rails-c1deb81cd005d7091b680ec2089b9b8dba41325f.tar.bz2 rails-c1deb81cd005d7091b680ec2089b9b8dba41325f.zip |
Isolate access to .default_scopes in ActiveRecord::Scoping::Default
Instead use .scope_attributes? consistently in ActiveRecord to check whether
there are attributes currently associated with the scope.
Move the implementation of .scope_attributes? and .scope_attributes to
ActiveRecord::Scoping because they don't particularly have to do specifically
with Named scopes and their only dependency, in the case of
.scope_attributes?, and only caller, in the case of .scope_attributes is
contained in Scoping.
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r-- | activerecord/lib/active_record/associations/collection_association.rb | 3 | ||||
-rw-r--r-- | activerecord/lib/active_record/associations/singular_association.rb | 3 |
2 files changed, 2 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/associations/collection_association.rb b/activerecord/lib/active_record/associations/collection_association.rb index 0ba03338f6..1e245926e0 100644 --- a/activerecord/lib/active_record/associations/collection_association.rb +++ b/activerecord/lib/active_record/associations/collection_association.rb @@ -432,8 +432,7 @@ module ActiveRecord def get_records if reflection.scope_chain.any?(&:any?) || scope.eager_loading? || - klass.current_scope || - klass.default_scopes.any? + klass.scope_attributes? return scope.to_a end diff --git a/activerecord/lib/active_record/associations/singular_association.rb b/activerecord/lib/active_record/associations/singular_association.rb index c44242a0f0..58d0f7d65d 100644 --- a/activerecord/lib/active_record/associations/singular_association.rb +++ b/activerecord/lib/active_record/associations/singular_association.rb @@ -41,8 +41,7 @@ module ActiveRecord def get_records if reflection.scope_chain.any?(&:any?) || scope.eager_loading? || - klass.current_scope || - klass.default_scopes.any? + klass.scope_attributes? return scope.limit(1).to_a end |