aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source
diff options
context:
space:
mode:
authorRafael Mendonça França <rafael.franca@plataformatec.com.br>2013-09-04 20:48:15 -0300
committerRafael Mendonça França <rafael.franca@plataformatec.com.br>2013-09-04 20:48:15 -0300
commit0d2d10d8c4f5dd906e40a91fbf9781d915727acf (patch)
treec04eb63b7d537762cfd6d802e4a515934bbba4e3 /guides/source
parent90155b4e28a3887dce9428e9df150ede3d6c7465 (diff)
downloadrails-0d2d10d8c4f5dd906e40a91fbf9781d915727acf.tar.gz
rails-0d2d10d8c4f5dd906e40a91fbf9781d915727acf.tar.bz2
rails-0d2d10d8c4f5dd906e40a91fbf9781d915727acf.zip
Review the changes made on 90155b4e28a3887dce9428e9df150ede3d6c7465
Diffstat (limited to 'guides/source')
-rw-r--r--guides/source/active_record_querying.md14
1 files changed, 9 insertions, 5 deletions
diff --git a/guides/source/active_record_querying.md b/guides/source/active_record_querying.md
index 6c06399673..cb5fe52506 100644
--- a/guides/source/active_record_querying.md
+++ b/guides/source/active_record_querying.md
@@ -1505,18 +1505,21 @@ Person.ids
Existence of Objects
--------------------
-If you simply want to check for the existence of the object there's a method called `exists?`. This method will query the database using the same query as `find`, but instead of returning an object or collection of objects it will return either `true` or `false`.
+If you simply want to check for the existence of the object there's a method called `exists?`.
+This method will query the database using the same query as `find`, but instead of returning an
+object or collection of objects it will return either `true` or `false`.
```ruby
Client.exists?(1)
```
-The `exists?` method also takes multiple ids, but the catch is that it will return true if any one of those records exists.
+The `exists?` method also takes multiple values, but the catch is that it will return `true` if any
+one of those records exists.
```ruby
-Client.exists?id:[1,2,3]
+Client.exists?(id: [1,2,3])
or
-Client.exists?name:['John','Sergei']
+Client.exists?(name: ['John', 'Sergei'])
```
It's even possible to use `exists?` without any arguments on a model or a relation.
@@ -1525,7 +1528,8 @@ It's even possible to use `exists?` without any arguments on a model or a relati
Client.where(first_name: 'Ryan').exists?
```
-The above returns `true` if there is at least one client with the `first_name` 'Ryan' and `false` otherwise.
+The above returns `true` if there is at least one client with the `first_name` 'Ryan' and `false`
+otherwise.
```ruby
Client.exists?