提交 f7d9e09e 编写于 作者: J Jeremy Kemper

Merge branch 'master' of git@github.com:rails/rails

......@@ -897,7 +897,7 @@ def render(options = nil, extra_options = {}, &block) #:doc:
render_for_text(@template.render(options), options[:status])
elsif action_name = options[:action]
render_for_file(default_template_name(action_name.to_s), options[:status], nil, options[:locals] || {})
render_for_file(default_template_name(action_name.to_s), options[:status])
elsif xml = options[:xml]
response.content_type ||= Mime::XML
......
......@@ -245,7 +245,7 @@ def render_with_a_layout(options = nil, extra_options = {}, &block) #:nodoc:
template_with_options = options.is_a?(Hash)
if (layout = pick_layout(template_with_options, options)) && apply_layout?(template_with_options, options)
options = options.merge :layout => false if template_with_options
options.delete(:layout) if template_with_options
logger.info("Rendering template within #{layout}") if logger
content_for_layout = render_with_no_layout(options, extra_options, &block)
......
......@@ -371,6 +371,12 @@ def update_page_with_instance_variables
end
end
def update_page_with_view_method
render :update do |page|
page.replace_html 'person', pluralize(2, 'person')
end
end
def action_talk_to_layout
# Action template sets variable that's picked up by layout
end
......@@ -1022,6 +1028,13 @@ def test_update_page_with_instance_variables
assert_match /\$37/, @response.body
end
def test_update_page_with_view_method
get :update_page_with_view_method
assert_template nil
assert_equal 'text/javascript; charset=utf-8', @response.headers['type']
assert_match /2 people/, @response.body
end
def test_yield_content_for
assert_not_deprecated { get :yield_content_for }
assert_equal "<title>Putting stuff in the title!</title>\n\nGreat stuff!\n", @response.body
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册