diff options
author | Rick Olson <technoweenie@gmail.com> | 2007-04-08 17:16:36 +0000 |
---|---|---|
committer | Rick Olson <technoweenie@gmail.com> | 2007-04-08 17:16:36 +0000 |
commit | e0f834267642c526299189916ad9c97318c1b121 (patch) | |
tree | b549b24beb52937931246fa22fd421aaec30e420 /actionpack/lib/action_controller/mime_responds.rb | |
parent | bdb1fcc3b8e0293f8b099111da2302fedf4fd513 (diff) | |
download | rails-e0f834267642c526299189916ad9c97318c1b121.tar.gz rails-e0f834267642c526299189916ad9c97318c1b121.tar.bz2 rails-e0f834267642c526299189916ad9c97318c1b121.zip |
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
Diffstat (limited to 'actionpack/lib/action_controller/mime_responds.rb')
-rw-r--r-- | actionpack/lib/action_controller/mime_responds.rb | 9 |
1 files changed, 5 insertions, 4 deletions
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 |