提交 59b93dfd 编写于 作者: J Juanito Fatas

[ci skip] Remove duplicated last! section.

Reference: https://github.com/rails/rails/commit/d4fd0bd17709735ac91e434c94fe99429f078c6e

cc @schneems
上级 758ae373
...@@ -267,23 +267,6 @@ This is equivalent to writing: ...@@ -267,23 +267,6 @@ This is equivalent to writing:
Client.where(first_name: 'does not exist').take! Client.where(first_name: 'does not exist').take!
``` ```
#### `last!`
`Model.last!` finds the last record ordered by the primary key. For example:
```ruby
client = Client.last!
# => #<Client id: 221, first_name: "Russel">
```
The SQL equivalent of the above is:
```sql
SELECT * FROM clients ORDER BY clients.id DESC LIMIT 1
```
`Model.last!` raises `ActiveRecord::RecordNotFound` if no matching record is found.
### Retrieving Multiple Objects in Batches ### Retrieving Multiple Objects in Batches
We often need to iterate over a large set of records, as when we send a newsletter to a large set of users, or when we export data. We often need to iterate over a large set of records, as when we send a newsletter to a large set of users, or when we export data.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册