diff options
Diffstat (limited to 'actionpack')
-rwxr-xr-x | actionpack/lib/action_controller/base.rb | 4 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/prototype_helper.rb | 13 |
2 files changed, 14 insertions, 3 deletions
diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index b0b6069420..0793178a93 100755 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -1003,7 +1003,9 @@ module ActionController #:nodoc: end def template_exempt_from_layout?(template_name = default_template_name) - @template.javascript_template_exists?(template_name) + @template.pick_template_extension(template_name).to_sym == :rjs + rescue + false end def assert_existance_of_template_file(template_name) diff --git a/actionpack/lib/action_view/helpers/prototype_helper.rb b/actionpack/lib/action_view/helpers/prototype_helper.rb index 7781612180..d49bc94517 100644 --- a/actionpack/lib/action_view/helpers/prototype_helper.rb +++ b/actionpack/lib/action_view/helpers/prototype_helper.rb @@ -331,7 +331,11 @@ module ActionView # <tt>:with</tt>:: A JavaScript expression specifying the # parameters for the XMLHttpRequest. This defaults # to 'value', which in the evaluated context - # refers to the new field value. + # refers to the new field value. If you specify a + # string without a "=", it'll be extended to mean + # the form key that the value should be assigned to. + # So :with => "term" gives "'term'=value". If a "=" is + # present, no extension will happen. # <tt>:on</tt>:: Specifies which event handler to observe. By default, # it's set to "changed" for text fields and areas and # "click" for radio buttons and checkboxes. With this, @@ -692,7 +696,12 @@ module ActionView end def build_observer(klass, name, options = {}) - options[:with] ||= 'value' if options[:update] + if options[:with] && !options[:with].include?("=") + options[:with] = "'#{options[:with]}=' + value" + else + options[:with] ||= 'value' if options[:update] + end + callback = remote_function(options) javascript = "new #{klass}('#{name}', " javascript << "#{options[:frequency]}, " if options[:frequency] |