Upgrade Mongoid - update_attribute

21 Mar 2011

Before mongoid 2.0.0.rc.6, there is no update_attribute method for Mongoid::Document, it makes me unhappy. As in ActiveRecord world, I always use update_attribute to change one attribute and use update_attributes to change two or more attributes.

It's a good news that mongoid introduces the update_attribute method from 2.0.0.rc.6, now I can follow my practice in mongoid.

post.update_attribute(:title => "New Post")

post.update_attributes(:title => "New Post", :body => "New Body")


blog comments powered by Disqus