Fix rendering html partial via inline render when with :js format [#1399 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
This commit is contained in:
parent
9c01d3cead
commit
60d6f25517
|
@ -317,7 +317,8 @@ module ActionView #:nodoc:
|
|||
template
|
||||
elsif template = self.view_paths[template_file_name]
|
||||
template
|
||||
elsif @_render_stack.first && template = self.view_paths["#{template_file_name}.#{@_render_stack.first.format_and_extension}"]
|
||||
elsif (first_render = @_render_stack.first) && first_render.respond_to?(:format_and_extension) &&
|
||||
(template = self.view_paths["#{template_file_name}.#{first_render.format_and_extension}"])
|
||||
template
|
||||
elsif template_format == :js && template = self.view_paths["#{template_file_name}.html"]
|
||||
@template_format = :html
|
||||
|
|
|
@ -246,6 +246,15 @@ class TestController < ActionController::Base
|
|||
:locals => { :local_name => name }
|
||||
end
|
||||
|
||||
def helper_method_to_render_to_string(*args)
|
||||
render_to_string(*args)
|
||||
end
|
||||
helper_method :helper_method_to_render_to_string
|
||||
|
||||
def render_html_only_partial_within_inline
|
||||
render :inline => "Hello world <%= helper_method_to_render_to_string :partial => 'test/partial_with_only_html_version' %>"
|
||||
end
|
||||
|
||||
def formatted_html_erb
|
||||
end
|
||||
|
||||
|
@ -932,6 +941,11 @@ class RenderTest < ActionController::TestCase
|
|||
assert_equal "Goodbye, Local David", @response.body
|
||||
end
|
||||
|
||||
def test_rendering_html_only_partial_within_inline_with_js
|
||||
get :render_html_only_partial_within_inline, :format => :js
|
||||
assert_equal "Hello world partial with only html version", @response.body
|
||||
end
|
||||
|
||||
def test_should_render_formatted_template
|
||||
get :formatted_html_erb
|
||||
assert_equal 'formatted html erb', @response.body
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
partial with only html version
|
Loading…
Reference in New Issue