diff options
author | Bob Remeika <bob.remeika@gmail.com> | 2009-11-04 23:33:21 -0800 |
---|---|---|
committer | Stefan Penner <stefan.penner@gmail.com> | 2010-01-27 12:44:31 -0600 |
commit | 95b77e925f22376bd12698a8700259894b94dc57 (patch) | |
tree | 45c932bed39818215dc5565597ba5e67c23c81e3 /actionpack/lib/action_view/helpers | |
parent | 7d34975214e80d54786f92cf1daee7ec7847a07c (diff) | |
download | rails-95b77e925f22376bd12698a8700259894b94dc57.tar.gz rails-95b77e925f22376bd12698a8700259894b94dc57.tar.bz2 rails-95b77e925f22376bd12698a8700259894b94dc57.zip |
Added observe_form
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 + '"'} |