是的,方法是update_all.
# Update all books with 'Rails' in their title
Book.update_all "author = 'David'", "title LIKE '%Rails%'"
Run Code Online (Sandbox Code Playgroud)
http://apidock.com/rails/ActiveRecord/Relation/update_all
| 归档时间: |
|
| 查看次数: |
2689 次 |
| 最近记录: |