method
build_observer
rails latest stable - Class:
ActionView::Helpers::PrototypeHelper
build_observer(klass, name, options = {})protected
No documentation available.
# File actionpack/lib/action_view/helpers/prototype_helper.rb, line 1075
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 << ")"
javascript_tag(javascript)
end