out of time
-
Use observers with Mongoid 2 and Rails 3
Mongoid 2 doesn’t have built-in support for ActiveModel observers, but thanks to the modular design of Rails 3, it’s trivial to tack on:
Drop that somewhere into your load path, include
Mongoid::Observingin the models you’d like to observe, and it’ll work just like ActiveRecord observers.