My question is similar to this one How to skip ActiveRecord callbacks? but instead of AR I’m using Mongoid, It seems like that isn’t implemented yet in the current version of Mongoid, so I’d like to know what should be an elegant solution to implement it. (if necessary).
My question is similar to this one How to skip ActiveRecord callbacks? but instead
Share
Yes you can!
Mongoid is built on ActiveModel and ActiveModel has a skip_callback function. You can use
skip_callbacklike this:I’m using this without a hitch in a big app. For more info, see this blog post by Jeff Kreeftmeijer:
http://jeffkreeftmeijer.com/2010/disabling-activemodel-callbacks/