From e0f834267642c526299189916ad9c97318c1b121 Mon Sep 17 00:00:00 2001 From: Rick Olson Date: Sun, 8 Apr 2007 17:16:36 +0000 Subject: Change default respond_to templates for xml and rjs formats. [Rick] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6507 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_controller/mime_responds.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'actionpack/lib/action_controller/mime_responds.rb') diff --git a/actionpack/lib/action_controller/mime_responds.rb b/actionpack/lib/action_controller/mime_responds.rb index ff07c3c12e..e4d1dbbccc 100644 --- a/actionpack/lib/action_controller/mime_responds.rb +++ b/actionpack/lib/action_controller/mime_responds.rb @@ -107,10 +107,11 @@ module ActionController #:nodoc: end class Responder #:nodoc: - DEFAULT_BLOCKS = [:html, :js, :xml].inject({}) do |blocks, ext| - template_extension = (ext == :html ? '' : ".r#{ext}") - blocks.update ext => %(Proc.new { render :action => "\#{action_name}#{template_extension}", :content_type => Mime::#{ext.to_s.upcase} }) - end + default_block_format = %(Proc.new { render :action => "\#{action_name}%s", :content_type => Mime::%s }) + DEFAULT_BLOCKS = {} + DEFAULT_BLOCKS[:html] = default_block_format % ['', 'HTML'] + DEFAULT_BLOCKS[:js] = default_block_format % ['.js.rjs', 'JS'] + DEFAULT_BLOCKS[:xml] = default_block_format % ['.xml.builder', 'XML'] def initialize(block_binding) @block_binding = block_binding -- cgit v1.2.3