aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/active_record_querying.md
diff options
context:
space:
mode:
authorVijay Dev <vijaydev.cse@gmail.com>2013-03-30 15:46:14 +0530
committerVijay Dev <vijaydev.cse@gmail.com>2013-03-30 15:46:14 +0530
commit6d8c070821bc846eb263b8c045ae652ebd751569 (patch)
tree414dcf7d7a9a5885235b0426e545bd21b994091d /guides/source/active_record_querying.md
parent022ed6c763d91e1bb032150fc7ec5991141f8119 (diff)
parent6bd1bbe7cf87ae2b4764e0ed0d5b583bd026af8a (diff)
downloadrails-6d8c070821bc846eb263b8c045ae652ebd751569.tar.gz
rails-6d8c070821bc846eb263b8c045ae652ebd751569.tar.bz2
rails-6d8c070821bc846eb263b8c045ae652ebd751569.zip
Merge branch 'master' of github.com:lifo/docrails
Conflicts: activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb activerecord/test/cases/adapter_test.rb guides/source/testing.md [ci skip]
Diffstat (limited to 'guides/source/active_record_querying.md')
-rw-r--r--guides/source/active_record_querying.md14
1 files changed, 5 insertions, 9 deletions
diff --git a/guides/source/active_record_querying.md b/guides/source/active_record_querying.md
index 7355f6816c..2589accadd 100644
--- a/guides/source/active_record_querying.md
+++ b/guides/source/active_record_querying.md
@@ -506,19 +506,15 @@ This code will generate SQL like this:
SELECT * FROM clients WHERE (clients.orders_count IN (1,3,5))
```
-### NOT, LIKE, and NOT LIKE Conditions
+### NOT Conditions
-`NOT`, `LIKE`, and `NOT LIKE` SQL queries can be built by `where.not`, `where.like`, and `where.not_like` respectively.
+`NOT` SQL queries can be built by `where.not`.
```ruby
Post.where.not(author: author)
-
-Author.where.like(name: 'Nari%')
-
-Developer.where.not_like(name: 'Tenderl%')
```
-In other words, these sort of queries can be generated by calling `where` with no argument, then immediately chain with `not`, `like`, or `not_like` passing `where` conditions.
+In other words, this query can be generated by calling `where` with no argument, then immediately chain with `not` passing `where` conditions.
Ordering
--------
@@ -971,7 +967,7 @@ SELECT categories.* FROM categories
INNER JOIN posts ON posts.category_id = categories.id
```
-Or, in English: "return a Category object for all categories with posts". Note that you will see duplicate categories if more than one post has the same category. If you want unique categories, you can use `Category.joins(:posts).select("distinct(categories.id)")`.
+Or, in English: "return a Category object for all categories with posts". Note that you will see duplicate categories if more than one post has the same category. If you want unique categories, you can use `Category.joins(:posts).uniq`.
#### Joining Multiple Associations
@@ -1298,7 +1294,7 @@ recommended that you use the block form of `unscoped`:
```ruby
Client.unscoped {
- Client.created_before(Time.zome.now)
+ Client.created_before(Time.zone.now)
}
```