From 3c7d39d65f6ad55543cd2d12aec22dd8f927f1c6 Mon Sep 17 00:00:00 2001 From: "Erik St. Martin" <alakriti@gmail.com> Date: Tue, 26 Jan 2010 16:20:25 -0500 Subject: observe_form now supports :with option as it should --- actionpack/lib/action_view/helpers/ajax_helper.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_view/helpers/ajax_helper.rb b/actionpack/lib/action_view/helpers/ajax_helper.rb index 2ef791b834..343bd78bbd 100644 --- a/actionpack/lib/action_view/helpers/ajax_helper.rb +++ b/actionpack/lib/action_view/helpers/ajax_helper.rb @@ -496,8 +496,11 @@ module ActionView # +observe_field+. The JavaScript variable +value+ available to the # <tt>:with</tt> option is set to the serialized form by default. def observe_form(name, options = {}) + html_options = options.delete(:callbacks) + options[:observed] = name attributes = extract_observer_attributes!(options) + attributes.merge!(html_options) if html_options script_decorator(attributes).html_safe! end @@ -609,6 +612,13 @@ module ActionView options.merge!(:callbacks => html) super end + + def observe_form(name, options = {}) + html = {} + set_with_and_condition_attributes(options, html) + options.merge!(:callbacks => html) + super + end private def set_callbacks(options, html) -- cgit v1.2.3