Enables one or more observers. This supports multiple forms:
ORM.observers.enable :user_observer # => enables the UserObserver User.observers.enable AuditTrail # => enables the AuditTrail observer for User notifications. # Other models will not be affected (i.e. they will not # trigger notifications to AuditTrail if previously disabled) ORM.observers.enable :observer_1, :observer_2 # => enables Observer1 and Observer2 for all models. ORM.observers.enable :all # => enables all observers for all models. User.observers.enable :all do # all user observers are enabled for # just the duration of the block end
Note: all observers are enabled by default. This method is only useful when you have previously disabled one or more observers.
# File activemodel/lib/active_model/observer_array.rb, line 64 def enable(*observers, &block) set_enablement(true, observers, &block) end