Skip to content

Instantly share code, notes, and snippets.

@gawin
gawin / mongoid.rb
Created May 24, 2011 14:24 — forked from whereisciao/mongoid.rb
Mongoid Observer using ActiveModel.
require "#{RAILS_ROOT}/lib/mongoid/lib/observing.rb"
# Initializer for Observers
User.observers = :user_observer
User.instantiate_observers
# The preferred syntax, similar to AR's setup
# Mongoid.configure do |config|
# config.observers = :user_observer