提交 f9c63ad5 编写于 作者: R Rafael Mendonça França

Merge pull request #7776 from smartinez87/changelog_entry

Add #update_columns entry to AR Changelog. [ci skip]
## Rails 4.0.0 (unreleased) ##
* Added `#update_columns` method which updates the attributes from
the passed-in hash without calling save, hence skipping validations and
callbacks. `ActiveRecordError` will be raised when called on new objects
or when at least one of the attributes is marked as read only.
post.attributes # => {"id"=>2, "title"=>"My title", "body"=>"My content", "author"=>"Peter"}
post.update_columns({title: 'New title', author: 'Sebastian'}) # => true
post.attributes # => {"id"=>2, "title"=>"New title", "body"=>"My content", "author"=>"Sebastian"}
*Sebastian Martinez*
* Allow before and after validations to take an array of lifecycle events
*John Foley*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册