Skip to content
Browse files

fixes markup of the CHANGELOG entry from 455d710

  • Loading branch information...
1 parent 34be804 commit 9a421aaa8285cf2a7ecb1af370748b0337818930 @fxn fxn committed Mar 16, 2013
Showing with 14 additions and 14 deletions.
  1. +14 −14 activerecord/CHANGELOG.md
View
28 activerecord/CHANGELOG.md
@@ -2,26 +2,26 @@
* Counter caches on associations will now stay valid when attributes are
updated (not just when records are created or destroyed), for example,
- when calling +update_attributes+. The following code now works:
+ when calling `update_attributes`. The following code now works:
- class Comment < ActiveRecord::Base
- belongs_to :post, counter_cache: true
- end
+ class Comment < ActiveRecord::Base
+ belongs_to :post, counter_cache: true
+ end
- class Post < ActiveRecord::Base
- has_many :comments
- end
+ class Post < ActiveRecord::Base
+ has_many :comments
+ end
- post = Post.create
- comment = Comment.create
+ post = Post.create
+ comment = Comment.create
- post.comments << comment
- post.save.reload.comments_count # => 1
- comment.update_attributes(:post_id => nil)
+ post.comments << comment
+ post.save.reload.comments_count # => 1
+ comment.update_attributes(post_id: nil)
- post.save.reload.comments_count # => 0
+ post.save.reload.comments_count # => 0
- Updating the id of a +belongs_to+ object with the id of a new object will
+ Updating the id of a `belongs_to` object with the id of a new object will
also keep the count accurate.
*John Wang*

0 comments on commit 9a421aa

Please sign in to comment.
Something went wrong with that request. Please try again.