Flowdock
method

scoping

Importance_1
v4.0.2 - Show latest stable - 0 notes - Class: ActiveRecord::Relation
scoping() public

Scope all queries to the current scope.

Comment.where(post_id: 1).scoping do
  Comment.first
end
# => SELECT "comments".* FROM "comments" WHERE "comments"."post_id" = 1 ORDER BY "comments"."id" ASC LIMIT 1

Please check unscoped if you want to remove all previous scopes (including the default_scope) during the execution of a block.

Show source
Register or log in to add new notes.