Permalink
Browse files

Aesthetic [ci skip]

  • Loading branch information...
1 parent 56c8242 commit 28a0dd4de1c9ba2a1b7c7260c7049d39807457d0 @rafaelfranca rafaelfranca committed Feb 18, 2014
Showing with 4 additions and 4 deletions.
  1. +4 −4 guides/source/active_record_querying.md
@@ -1246,15 +1246,15 @@ 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')
# => SELECT "users".* FROM "users" WHERE "users"."state" = 'active' AND "users"."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

0 comments on commit 28a0dd4

Please sign in to comment.