diff options
author | Jeff Minnear <jeffminnear@gmail.com> | 2015-11-19 08:53:20 -0500 |
---|---|---|
committer | Jeff Minnear <jeffminnear@gmail.com> | 2015-11-30 09:27:58 -0500 |
commit | b20ef7e92f718cf00da9c0e3a4914fc949e2fe72 (patch) | |
tree | 63b467c32b8548451217cb2181be97fc26de4672 /guides | |
parent | 7e62a65e18d1e97debfa1c6215b7541157489115 (diff) | |
download | rails-b20ef7e92f718cf00da9c0e3a4914fc949e2fe72.tar.gz rails-b20ef7e92f718cf00da9c0e3a4914fc949e2fe72.tar.bz2 rails-b20ef7e92f718cf00da9c0e3a4914fc949e2fe72.zip |
Modify unscoped usage guide to include chaining
Diffstat (limited to 'guides')
-rw-r--r-- | guides/source/active_record_querying.md | 11 |
1 files changed, 9 insertions, 2 deletions
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 { |