diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-02-18 11:45:15 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-02-18 12:05:20 -0300 |
commit | 28a0dd4de1c9ba2a1b7c7260c7049d39807457d0 (patch) | |
tree | 8ad94824556b6cf4a33dbb449f16059afeabe5a8 /guides/source/active_record_querying.md | |
parent | 56c8242185c7ed64e891a59420d6c06e66f95cd7 (diff) | |
download | rails-28a0dd4de1c9ba2a1b7c7260c7049d39807457d0.tar.gz rails-28a0dd4de1c9ba2a1b7c7260c7049d39807457d0.tar.bz2 rails-28a0dd4de1c9ba2a1b7c7260c7049d39807457d0.zip |
Aesthetic [ci skip]
Diffstat (limited to 'guides/source/active_record_querying.md')
-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 e7de8034c2..31d109a1ca 100644 --- a/guides/source/active_record_querying.md +++ b/guides/source/active_record_querying.md @@ -1246,7 +1246,7 @@ User.active.inactive ``` We can mix and match `scope` and `where` conditions and the final sql -will have all conditions joined with `AND` . +will have all conditions joined with `AND`. ```ruby User.active.where(state: 'finished') @@ -1254,7 +1254,7 @@ User.active.where(state: 'finished') ``` If we do want the `last where clause` to win then `Relation#merge` can -be used . +be used. ```ruby User.active.merge(User.inactive) @@ -1275,10 +1275,10 @@ User.all # => SELECT "users".* FROM "users" WHERE "users"."state" = 'pending' User.active -# => SELECT "users".* FROM "users" WHERE "users"."status" = 'pending' AND "users"."status" = 'active' +# => SELECT "users".* FROM "users" WHERE "users"."status" = 'pending' AND "users"."status" = 'active' User.where(state: 'inactive') -# => SELECT "users".* FROM "users" WHERE "users"."status" = 'pending' AND "users"."status" = 'inactive' +# => SELECT "users".* FROM "users" WHERE "users"."status" = 'pending' AND "users"."status" = 'inactive' ``` As you can see above the `default_scope` is being merged in both |