From b20ef7e92f718cf00da9c0e3a4914fc949e2fe72 Mon Sep 17 00:00:00 2001 From: Jeff Minnear Date: Thu, 19 Nov 2015 08:53:20 -0500 Subject: Modify unscoped usage guide to include chaining --- guides/source/active_record_querying.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'guides/source/active_record_querying.md') diff --git a/guides/source/active_record_querying.md b/guides/source/active_record_querying.md index ec31fa9d67..c5eba38a78 100644 --- a/guides/source/active_record_querying.md +++ b/guides/source/active_record_querying.md @@ -1374,8 +1374,15 @@ Client.unscoped.load This method removes all scoping and will do a normal query on the table. -Note that chaining `unscoped` with a `scope` does not work. In these cases, it is -recommended that you use the block form of `unscoped`: +```ruby +Client.unscoped.all +# SELECT "clients".* FROM "clients" + +Client.where(published: false).unscoped.all +# SELECT "clients".* FROM "clients" +``` + +`unscoped` can also accept a block. ```ruby Client.unscoped { -- cgit v1.2.3