diff options
Diffstat (limited to 'actionpack/lib/action_view/helpers')
-rw-r--r-- | actionpack/lib/action_view/helpers/ajax_helper.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/helpers/ajax_helper.rb b/actionpack/lib/action_view/helpers/ajax_helper.rb index 1a75f9372b..5de33868e9 100644 --- a/actionpack/lib/action_view/helpers/ajax_helper.rb +++ b/actionpack/lib/action_view/helpers/ajax_helper.rb @@ -74,6 +74,14 @@ module ActionView script_decorator(attributes) end + def observe_form(name, options = {}) + options[:observed] = name + attributes = extract_observer_attributes!(options) + attributes["data-js-type"] = "form_observer" + + script_decorator(attributes) + end + def script_decorator(options) attributes = %w(type="application/json") attributes += options.map{|k, v| k + '="' + v.to_s + '"'} |