Permalink
Browse files

observe_form now supports :with option as it should

  • Loading branch information...
1 parent 5584d58 commit 3c7d39d65f6ad55543cd2d12aec22dd8f927f1c6 @erikstmartin erikstmartin committed with stefanpenner Jan 26, 2010
Showing with 10 additions and 0 deletions.
  1. +10 −0 actionpack/lib/action_view/helpers/ajax_helper.rb
@@ -496,8 +496,11 @@ def observe_field(name, options = {})
# +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 @@ def observe_field(name, options = {})
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)

0 comments on commit 3c7d39d

Please sign in to comment.