How to update all in mongoid

March 4, 2012 § Leave a comment

in Active record we simply use Model.update_all() then how we do that in mongoid ?
simple.. use collection.update, example:

Article.collection.update({:user_id => self.id}, {"$set" => {:status => self.status}}, {:multi => true})
Advertisements

Where Am I?

You are currently viewing the archives for March, 2012 at Kubid on rails blog.