提交 b5e851e9 编写于 作者: G Guillermo Iguaran

Merge pull request #11437 from kennyj/fix_11393

Fix #11393. Fix default rendered format when calling render method without :content_type option.
* Fix default rendered format problem when calling `render` without :content_type option.
It should return :html. Fix #11393.
*Gleb Mazovetskiy* *Oleg* *kennyj*
* Fix `link_to` with block and url hashes.
Before:
......
......@@ -11,7 +11,7 @@ def render(context, options)
prepend_formats(template.formats)
unless context.rendered_format
context.rendered_format = template.formats.first || formats.last
context.rendered_format = template.formats.first || formats.first
end
render_template(template, options[:layout], options[:locals])
......
......@@ -41,6 +41,11 @@ def test_render_template_with_format
assert_match "<error>No Comment</error>", @view.render(:template => "comments/empty", :formats => [:xml])
end
def test_rendered_format_without_format
@view.render(:inline => "test")
assert_equal :html, @view.lookup_context.rendered_format
end
def test_render_partial_implicitly_use_format_of_the_rendered_template
@view.lookup_context.formats = [:json]
assert_equal "Hello world", @view.render(:template => "test/one", :formats => [:html])
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册