method
scope
rails latest stable - Class:
ActiveRecord::Associations::AssociationScope
scope(association)public
No documentation available.
# File activerecord/lib/active_record/associations/association_scope.rb, line 21
def scope(association)
klass = association.klass
reflection = association.reflection
scope = klass.unscoped
owner = association.owner
chain = get_chain(reflection, association, scope.alias_tracker)
scope.extending! reflection.extensions
scope = add_constraints(scope, owner, chain)
scope.limit!(1) unless reflection.collection?
scope
end