diff options
Diffstat (limited to 'guides')
-rw-r--r-- | guides/source/active_record_querying.md | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/guides/source/active_record_querying.md b/guides/source/active_record_querying.md index f8c64cbd0c..f7ea72b68d 100644 --- a/guides/source/active_record_querying.md +++ b/guides/source/active_record_querying.md @@ -257,6 +257,12 @@ It is equivalent to writing: Client.where(first_name: 'Lifo').take ``` +The SQL equivalent of the above is: + +```sql +SELECT * FROM clients WHERE (clients.first_name = 'Lifo') LIMIT 1 +``` + The `find_by!` method behaves exactly like `find_by`, except that it will raise `ActiveRecord::RecordNotFound` if no matching record is found. For example: ```ruby |