Skip to content

Commit 46f0fc6

Browse files
smartinez87vijaydev
authored andcommitted
Add #update_columns entry in Rails 4.0 release notes [ci skip]
1 parent 7a2b809 commit 46f0fc6

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

guides/source/4_0_release_notes.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,14 @@ Active Record
652652
653653
* PostgreSQL hstore types are automatically deserialized from the database.
654654
655+
* 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.
656+
657+
```ruby
658+
post.attributes # => {"id"=>2, "title"=>"My title", "body"=>"My content", "author"=>"Peter"}
659+
post.update_columns({title: 'New title', author: 'Sebastian'}) # => true
660+
post.attributes # => {"id"=>2, "title"=>"New title", "body"=>"My content", "author"=>"Sebastian"}
661+
```
662+
655663
### Deprecations
656664
657665
* Deprecated most of the 'dynamic finder' methods. All dynamic methods except for `find_by_...` and `find_by_...!` are deprecated. Here's how you can rewrite the code:

0 commit comments

Comments
 (0)