method

observers=

rails latest stable - Class: ActiveRecord::Observing::ClassMethods

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v2.3.8) is shown here.

observers=(*observers)
public

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.