instance method
instantiate_observers
Ruby on Rails 2.2.3
Since v2.2.3 Last seen in v2.3.18Available in: v2.2.3 v2.3.18
Signature
instantiate_observers()
Instantiate the global Active Record observers.
Source
# File activerecord/lib/active_record/observer.rb, line 34
def instantiate_observers
return if @observers.blank?
@observers.each do |observer|
if observer.respond_to?(:to_sym) # Symbol or String
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
end
Defined in activerecord/lib/active_record/observer.rb line 34
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Observing::ClassMethods