diff options
author | Rashmi Yadav <rays.rashmi@gmail.com> | 2014-01-29 12:26:18 +0100 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-02-18 11:41:22 -0300 |
commit | a8a7654f403611a4b992ffac30c07089be370b7a (patch) | |
tree | 69b721ccc92dd6b46f8145050bc1ff4c83475cd8 /guides | |
parent | 5d037819ca80606638212f83de741cc2041db28f (diff) | |
download | rails-a8a7654f403611a4b992ffac30c07089be370b7a.tar.gz rails-a8a7654f403611a4b992ffac30c07089be370b7a.tar.bz2 rails-a8a7654f403611a4b992ffac30c07089be370b7a.zip |
Updated doc for default scope [ci skip]
Diffstat (limited to 'guides')
-rw-r--r-- | guides/source/active_record_querying.md | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/guides/source/active_record_querying.md b/guides/source/active_record_querying.md index d164b08d93..1a154e143a 100644 --- a/guides/source/active_record_querying.md +++ b/guides/source/active_record_querying.md @@ -1261,7 +1261,7 @@ User.active.merge(User.inactive) # => SELECT "users".* FROM "users" WHERE "users"."state" = 'inactive' ``` -One important caveat is that `default_scope` will be overridden by +One important caveat is that `default_scope` will be merged in `scope` and `where` conditions. ```ruby @@ -1275,13 +1275,13 @@ User.all # => SELECT "users".* FROM "users" WHERE "users"."state" = 'pending' User.active -# => SELECT "users".* FROM "users" WHERE "users"."state" = 'active' +# => SELECT "users".* FROM "users" WHERE "users"."status" = 'pending' AND "users"."status" = 'active' User.where(state: 'inactive') -# => SELECT "users".* FROM "users" WHERE "users"."state" = 'inactive' +# => SELECT "users".* FROM "users" WHERE "users"."status" = 'pending' AND "users"."status" = 'inactive' ``` -As you can see above the `default_scope` is being overridden by both +As you can see above the `default_scope` is being merged in both `scope` and `where` conditions. |