method

observers=

Importance_1
v3.0.9 - Show latest stable - 0 notes - Class: ActiveModel::Observing::ClassMethods
observers=(*values) public

Active Model Observers Activation

Activates the observers assigned. Examples:

# Calls PersonObserver.instance
ActiveRecord::Base.observers = :person_observer

# Calls Cacher.instance and GarbageCollector.instance
ActiveRecord::Base.observers = :cacher, :garbage_collector

# Same as above, just using explicit class references
ActiveRecord::Base.observers = Cacher, GarbageCollector

Note: Setting this does not instantiate the observers yet. instantiate_observers is called during startup, and before each development request.

Show source
Register or log in to add new notes.