Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make observer enable/disable documentation more informative.

* Moved the simplest case--enable/disable all on all--to the top.
* Made clear what "ORM" means to avoid having to teach people how to solve "uninitialized constant ORM"
  errors in their test reports.
  • Loading branch information...
commit f20208842ab1f5f6f44b08bda5beb35985c5dd5e 1 parent b1f634a
@robbkidd robbkidd authored
Showing with 10 additions and 6 deletions.
  1. +10 −6 activemodel/lib/active_model/observer_array.rb
View
16 activemodel/lib/active_model/observer_array.rb
@@ -17,6 +17,11 @@ def disabled_for?(observer)
# Disables one or more observers. This supports multiple forms:
#
+ # ORM.observers.disable :all
+ # # => disables all observers for all models subclassed from
+ # # an ORM base class that includes ActiveModel::Observing
+ # # e.g. ActiveRecord::Base
+ #
# ORM.observers.disable :user_observer
# # => disables the UserObserver
#
@@ -27,9 +32,6 @@ def disabled_for?(observer)
# ORM.observers.disable :observer_1, :observer_2
# # => disables Observer1 and Observer2 for all models.
#
- # ORM.observers.disable :all
- # # => disables all observers for all models.
- #
# User.observers.disable :all do
# # all user observers are disabled for
# # just the duration of the block
@@ -40,6 +42,11 @@ def disable(*observers, &block)
# Enables one or more observers. This supports multiple forms:
#
+ # ORM.observers.enable :all
+ # # => enables all observers for all models subclassed from
+ # # an ORM base class that includes ActiveModel::Observing
+ # # e.g. ActiveRecord::Base
+ #
# ORM.observers.enable :user_observer
# # => enables the UserObserver
#
@@ -51,9 +58,6 @@ def disable(*observers, &block)
# 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
Please sign in to comment.
Something went wrong with that request. Please try again.