mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Restore implicit rendering for XHR requests that want a HTML template [#1590 state:resolved]
This commit is contained in:
parent
f17c87665e
commit
093f758bd0
3 changed files with 12 additions and 0 deletions
|
@ -45,6 +45,9 @@ module ActionView #:nodoc:
|
|||
return template
|
||||
elsif template = load_path[template_path]
|
||||
return template
|
||||
# Try to find html version if the format is javascript
|
||||
elsif format == :js && template = load_path["#{template_path}.html"]
|
||||
return template
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -274,6 +274,9 @@ class TestController < ActionController::Base
|
|||
def render_explicit_html_template
|
||||
end
|
||||
|
||||
def render_implicit_html_template_from_xhr_request
|
||||
end
|
||||
|
||||
def formatted_html_erb
|
||||
end
|
||||
|
||||
|
@ -1010,6 +1013,11 @@ class RenderTest < ActionController::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
def test_should_implicitly_render_html_template_from_xhr_request
|
||||
get :render_implicit_html_template_from_xhr_request, :format => :js
|
||||
assert_equal "Hello HTML!", @response.body
|
||||
end
|
||||
|
||||
def test_should_render_formatted_template
|
||||
get :formatted_html_erb
|
||||
assert_equal 'formatted html erb', @response.body
|
||||
|
|
1
actionpack/test/fixtures/test/render_implicit_html_template_from_xhr_request.html.erb
vendored
Normal file
1
actionpack/test/fixtures/test/render_implicit_html_template_from_xhr_request.html.erb
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
Hello HTML!
|
Loading…
Reference in a new issue