diff options
author | Sergio <shernade@gmail.com> | 2013-09-05 00:40:14 +0200 |
---|---|---|
committer | Sergio <shernade@gmail.com> | 2013-09-05 00:40:14 +0200 |
commit | 90155b4e28a3887dce9428e9df150ede3d6c7465 (patch) | |
tree | f32514016ba65a21ad15928e2d2efe9f0eca0229 | |
parent | 67d88b5040e93672c4122817a8e3b21720b2d9fd (diff) | |
download | rails-90155b4e28a3887dce9428e9df150ede3d6c7465.tar.gz rails-90155b4e28a3887dce9428e9df150ede3d6c7465.tar.bz2 rails-90155b4e28a3887dce9428e9df150ede3d6c7465.zip |
Client.exists?(1,2,3) and Client.exists?([1,2,3]) does not work
The right command for doing that is Client.exists?id:[1,2,3]
Exists does not work like find method, in find method you can do Person.find(1, 2, 6) or Person.find([7, 17]) but not Person.exists?(1,2,3) or Person.exists?([1,2,3])
-rw-r--r-- | guides/source/active_record_querying.md | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/guides/source/active_record_querying.md b/guides/source/active_record_querying.md index ba0260c13c..6c06399673 100644 --- a/guides/source/active_record_querying.md +++ b/guides/source/active_record_querying.md @@ -1514,9 +1514,9 @@ 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. ```ruby -Client.exists?(1,2,3) -# or -Client.exists?([1,2,3]) +Client.exists?id:[1,2,3] +or +Client.exists?name:['John','Sergei'] ``` It's even possible to use `exists?` without any arguments on a model or a relation. |