aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/active_record_querying.md
diff options
context:
space:
mode:
authorKrzysztof Maicher <krzysztof.maicher@gmail.com>2017-05-25 14:34:50 +0200
committerKrzysztof Maicher <krzysztof.maicher@gmail.com>2017-05-25 15:20:36 +0200
commitaf41b98577a09c9177b0fae76b7d07d787d02ce3 (patch)
tree98333fb1e7b298ee85b4f2c168bb098c39a35af5 /guides/source/active_record_querying.md
parent3a628b9338c436001c00a9865b22036abd44a2bd (diff)
downloadrails-af41b98577a09c9177b0fae76b7d07d787d02ce3.tar.gz
rails-af41b98577a09c9177b0fae76b7d07d787d02ce3.tar.bz2
rails-af41b98577a09c9177b0fae76b7d07d787d02ce3.zip
Add ActiveRecord::Relation#or description to guides [ci skip]
Diffstat (limited to 'guides/source/active_record_querying.md')
-rw-r--r--guides/source/active_record_querying.md13
1 files changed, 13 insertions, 0 deletions
diff --git a/guides/source/active_record_querying.md b/guides/source/active_record_querying.md
index 26d01d4ede..d1cbe506b4 100644
--- a/guides/source/active_record_querying.md
+++ b/guides/source/active_record_querying.md
@@ -557,6 +557,19 @@ In other words, this query can be generated by calling `where` with no argument,
SELECT * FROM clients WHERE (clients.locked != 1)
```
+### OR Conditions
+
+`OR` condition between two relations can be build by calling `or` on the first relation
+and passing the second one as an argument.
+
+```ruby
+Client.where(locked: true).or(Client.where(orders_count: [1,3,5]))
+```
+
+```sql
+SELECT * FROM clients WHERE (clients.locked = 1 OR clients.orders_count IN (1,3,5))
+```
+
Ordering
--------