instance method
instantiate_observer
Ruby on Rails 2.3.18
Since v2.2.3 Last seen in v2.3.18Available in: v2.2.3 v2.3.18
Signature
instantiate_observer(observer)
No documentation comment.
Parameters
-
observerreq
Source
# File activemodel/lib/active_model/observing.rb, line 21
def instantiate_observer(observer)
# string/symbol
if observer.respond_to?(:to_sym)
observer = observer.to_s.camelize.constantize.instance
elsif observer.respond_to?(:instance)
observer.instance
else
raise ArgumentError, "#{observer} must be a lowercase, underscored class name (or an instance of the class itself) responding to the instance method. Example: Person.observers = :big_brother # calls BigBrother.instance"
end
end
Defined in activemodel/lib/active_model/observing.rb line 21
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveModel::Observing::ClassMethods