Skip to content

Commit b1e8b5e

Browse files
committed
Update the documentation for find_by method
1 parent 5446842 commit b1e8b5e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

guides/source/active_record_querying.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,8 @@ The SQL equivalent of the above is:
358358
SELECT * FROM customers WHERE (customers.first_name = 'Lifo') LIMIT 1
359359
```
360360

361+
Note that there is no `ORDER BY` in the above SQL. If your `find_by` conditions can match multiple records, you should [apply an order](#ordering) to guarantee a deterministic result.
362+
361363
The [`find_by!`][] method behaves exactly like `find_by`, except that it will raise `ActiveRecord::RecordNotFound` if no matching record is found. For example:
362364

363365
```irb

0 commit comments

Comments
 (0)