1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fix layouts with absolute paths [#2134 state:resolved]

Signed-off-by: Joshua Peek <josh@joshpeek.com>
This commit is contained in:
thedarkone 2009-03-05 18:49:22 -06:00 committed by Joshua Peek
parent 5b7527ca44
commit 3191535ff0
2 changed files with 11 additions and 2 deletions

View file

@ -913,7 +913,6 @@ module ActionController #:nodoc:
layout = pick_layout(options) layout = pick_layout(options)
response.layout = layout.path_without_format_and_extension if layout response.layout = layout.path_without_format_and_extension if layout
logger.info("Rendering template within #{layout.path_without_format_and_extension}") if logger && layout logger.info("Rendering template within #{layout.path_without_format_and_extension}") if logger && layout
layout = layout.path_without_format_and_extension if layout
if content_type = options[:content_type] if content_type = options[:content_type]
response.content_type = content_type.to_s response.content_type = content_type.to_s

View file

@ -79,6 +79,10 @@ end
class DefaultLayoutController < LayoutTest class DefaultLayoutController < LayoutTest
end end
class AbsolutePathLayoutController < LayoutTest
layout File.expand_path(File.expand_path(__FILE__) + '/../../fixtures/layout_tests/layouts/layout_test.rhtml')
end
class HasOwnLayoutController < LayoutTest class HasOwnLayoutController < LayoutTest
layout 'item' layout 'item'
end end
@ -143,6 +147,12 @@ class LayoutSetInResponseTest < ActionController::TestCase
get :hello get :hello
assert_equal 'layouts/alt', @response.layout assert_equal 'layouts/alt', @response.layout
end end
def test_absolute_pathed_layout
@controller = AbsolutePathLayoutController.new
get :hello
assert_equal "layout_test.rhtml hello.rhtml", @response.body.strip
end
end end
class RenderWithTemplateOptionController < LayoutTest class RenderWithTemplateOptionController < LayoutTest