instance method build_observer

Ruby on Rails 2.2.3

Since v2.2.3 Last seen in v2.3.18

Available in: v2.2.3 v2.3.18

Signature

build_observer(klass, name, options = {})

No documentation comment.

Parameters

klass req
name req
options opt = {}
Source
# File actionpack/lib/action_view/helpers/prototype_helper.rb, line 1084
      def build_observer(klass, name, options = {})
        if options[:with] && (options[:with] !~ /[\{=(.]/)
          options[:with] = "'#{options[:with]}=' + encodeURIComponent(value)"
        else
          options[:with] ||= 'value' unless options[:function]
        end

        callback = options[:function] || remote_function(options)
        javascript  = "new #{klass}('#{name}', "
        javascript << "#{options[:frequency]}, " if options[:frequency]
        javascript << "function(element, value) {"
        javascript << "#{callback}}"
        javascript << ", '#{options[:on]}'" if options[:on]
        javascript << ")"
        javascript_tag(javascript)
      end

Defined in actionpack/lib/action_view/helpers/prototype_helper.rb line 1084 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActionView::Helpers::PrototypeHelper

Type at least 2 characters to search.

↑↓ navigate · open · esc close