method
scope
v3.2.1 -
Show latest stable
- Class:
ActiveRecord::Associations::AssociationScope
scope()public
No documentation available.
# File activerecord/lib/active_record/associations/association_scope.rb, line 16
def scope
scope = klass.unscoped
scope = scope.extending(*Array.wrap(options[:extend]))
# It's okay to just apply all these like this. The options will only be present if the
# association supports that option; this is enforced by the association builder.
scope = scope.apply_finder_options(options.slice(
:readonly, :include, :order, :limit, :joins, :group, :having, :offset, :select))
if options[:through] && !options[:include]
scope = scope.includes(source_options[:include])
end
scope = scope.uniq if options[:uniq]
add_constraints(scope)
end