method

instantiate_observer

rails latest stable - Class: ActiveModel::Observing::ClassMethods

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v3.2.13) is shown here.

instantiate_observer(observer)
protected

No documentation available.

# File activemodel/lib/active_model/observing.rb, line 83
        def instantiate_observer(observer) #:nodoc:
          # string/symbol
          if observer.respond_to?(:to_sym)
            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