diff options
author | Claudio B <claudiob@users.noreply.github.com> | 2015-12-01 10:00:43 -0800 |
---|---|---|
committer | Claudio B <claudiob@users.noreply.github.com> | 2015-12-01 10:00:43 -0800 |
commit | c403edf9c150693df2477ddcf23dcd52e9bef9ff (patch) | |
tree | 734d867ef4940240b58e2726ad32c791e10b04a9 /guides/source/active_record_querying.md | |
parent | 208911e4c007b2dc1c1a9d6175abaf95522d00b4 (diff) | |
parent | b20ef7e92f718cf00da9c0e3a4914fc949e2fe72 (diff) | |
download | rails-c403edf9c150693df2477ddcf23dcd52e9bef9ff.tar.gz rails-c403edf9c150693df2477ddcf23dcd52e9bef9ff.tar.bz2 rails-c403edf9c150693df2477ddcf23dcd52e9bef9ff.zip |
Merge pull request #22343 from jeffminnear/patch-1
Modify unscoped usage guide to include chaining [ci skip]
Diffstat (limited to 'guides/source/active_record_querying.md')
-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 { |