Update the documentation for find_by method
This commit is contained in:
parent
5446842968
commit
b1e8b5ebc7
@ -358,6 +358,8 @@ The SQL equivalent of the above is:
|
||||
SELECT * FROM customers WHERE (customers.first_name = 'Lifo') LIMIT 1
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
The [`find_by!`][] method behaves exactly like `find_by`, except that it will raise `ActiveRecord::RecordNotFound` if no matching record is found. For example:
|
||||
|
||||
```irb
|
||||
|
Loading…
Reference in New Issue
Block a user