mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fix default rendered format problem when calling render method without :content_type option. Closes #11393.
This commit is contained in:
parent
9fbdd9d83e
commit
ca85caca0d
3 changed files with 11 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
|||
* 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 @@ module ActionView
|
|||
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 @@ module RenderTestCases
|
|||
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])
|
||||
|
|
Loading…
Reference in a new issue