Updated active_record_querying.md
Added the SQL equivalent of the find_by method Update active_record_querying.md Update active_record_querying.md
This commit is contained in:
parent
72570ea289
commit
edbc9468d5
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user