From bca66a3547ac166eccac3e8cfead3d93b3d0921b Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Fri, 28 Sep 2012 13:58:07 -0300 Subject: Add #update_columns entry to AR Changelog. --- activerecord/CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'activerecord/CHANGELOG.md') diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 344ee6416d..d52d6a7fde 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,5 +1,16 @@ ## 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* -- cgit v1.2.3