Class: Mongoid::Observer

Inherits:
ActiveModel::Observer
  • Object
show all
Defined in:
lib/mongoid/observer.rb

Overview

Mongoid observers hook into the lifecycle of documents.

Instance Method Summary collapse

Constructor Details

#initializeObserver

Instantiate the new observer. Will add all child observers as well.

Examples:

Instantiate the observer.

Mongoid::Observer.new

Since:

  • 2.0.0



13
14
15
# File 'lib/mongoid/observer.rb', line 13

def initialize
  super and observed_descendants.each { |klass| add_observer!(klass) }
end