diff options
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/CHANGELOG | 2 | ||||
-rw-r--r-- | actionpack/lib/action_view/base.rb | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index 9cb6db6b0b..13d362725e 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Tweak template format rules so that the ACCEPT header is only used if it's text/javascript. This is so ajax actions without a :format param get recognized as Mime::JS. [Rick] + * The default respond_to blocks don't set a specific extension anymore, so that both 'show.rjs' and 'show.js.rjs' will work. [Rick] * Allow layouts with extension of .html.erb. Closes #8032 [Josh Knowles] diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb index 1a4234b2c9..5ae3e7ba11 100644 --- a/actionpack/lib/action_view/base.rb +++ b/actionpack/lib/action_view/base.rb @@ -403,7 +403,19 @@ module ActionView #:nodoc: # symbolized version of the :format parameter of the request, or :html by default. def template_format - @template_format ||= controller.request.parameters[:format].to_sym rescue :html + if @template_format.nil? + @template_format = + begin + if controller.request.accepts.first == Mime::JS + :js + else + controller.request.parameters[:format].to_sym + end + rescue + :html + end + end + @template_format end def template_handler_preferences |