mirror of
https://github.com/github/rails.git
synced 2026-02-18 01:51:49 -05:00
r5515@ks: jeremy | 2006-10-08 13:24:42 -0700
#6281 r5516@ks: jeremy | 2006-10-08 13:29:49 -0700 respond_to :html doesn't assume .rhtml. Closes #6281. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5232 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
*SVN*
|
||||
|
||||
* respond_to :html doesn't assume .rhtml. #6281 [Hampton Catlin]
|
||||
|
||||
* Fixed some deprecation warnings in ActionPack [Rick Olson]
|
||||
|
||||
* assert_select_rjs decodes escaped unicode chars since the Javascript generators encode them. #6240 [japgolly]
|
||||
|
||||
@@ -108,8 +108,9 @@ module ActionController #:nodoc:
|
||||
|
||||
class Responder #:nodoc:
|
||||
DEFAULT_BLOCKS = [:html, :js, :xml].inject({}) do |blocks, ext|
|
||||
blocks.update ext => %(Proc.new { render :action => "\#{action_name}.r#{ext}", :content_type => Mime::#{ext.to_s.upcase} })
|
||||
end
|
||||
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
|
||||
|
||||
def initialize(block_binding)
|
||||
@block_binding = block_binding
|
||||
|
||||
@@ -303,4 +303,21 @@ class MimeControllerTest < Test::Unit::TestCase
|
||||
get :html_xml_or_rss, :format => "rss"
|
||||
assert_equal "RSS", @response.body
|
||||
end
|
||||
|
||||
def test_render_action_for_html
|
||||
@controller.instance_eval do
|
||||
def render(*args)
|
||||
unless args.empty?
|
||||
@action = args.first[:action]
|
||||
end
|
||||
response.body = @action
|
||||
end
|
||||
end
|
||||
|
||||
get :using_defaults
|
||||
assert_equal "using_defaults", @response.body
|
||||
|
||||
get :using_defaults, :format => "xml"
|
||||
assert_equal "using_defaults.rxml", @response.body
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user