提交 edbc9468 编写于 作者: A Ahmad Al-kheat 提交者: Ahmad

Updated active_record_querying.md

Added the SQL equivalent of the find_by method

Update active_record_querying.md

Update active_record_querying.md
上级 72570ea2
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册