scoping()
public
Scope all queries to the current scope.
Example
Comment.where(:post_id => 1).scoping do
Comment.first
end
Please check unscoped if you want to remove all previous scopes (including
the default_scope) during the execution of a block.
# File activerecord/lib/active_record/relation.rb, line 239
def scoping
@klass.with_scope(self, :overwrite) { yield }
end