method

observers=

Importance_1
Ruby on Rails latest stable (v7.1.3.2) - 0 notes - Class: ActiveModel::Observing::ClassMethods

Method deprecated or moved

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

observers=(*values) public

Active Model Observers Activation

Activates the observers assigned. Examples:

class ORM
  include ActiveModel::Observing
end

# Calls PersonObserver.instance
ORM.observers = :person_observer

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

# Same as above, just using explicit class references
ORM.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.