mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Improve observers documentation
This commit is contained in:
parent
3333fe283c
commit
7536731a9a
1 changed files with 2 additions and 0 deletions
|
@ -214,6 +214,7 @@ module ActiveModel
|
|||
end
|
||||
|
||||
# Start observing the declared classes and their subclasses.
|
||||
# Called automatically by the instance method.
|
||||
def initialize
|
||||
observed_classes.each { |klass| add_observer!(klass) }
|
||||
end
|
||||
|
@ -242,6 +243,7 @@ module ActiveModel
|
|||
klass.add_observer(self)
|
||||
end
|
||||
|
||||
# Returns true if notifications are disabled for this object.
|
||||
def disabled_for?(object)
|
||||
klass = object.class
|
||||
return false unless klass.respond_to?(:observers)
|
||||
|
|
Loading…
Reference in a new issue