mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Bring back rendering templates that start with / in nested structures
This commit is contained in:
parent
0b7548fab1
commit
e5e9a4cc76
2 changed files with 23 additions and 0 deletions
|
@ -152,6 +152,7 @@ module ActionView
|
|||
def normalize_name(name, prefixes) #:nodoc:
|
||||
prefixes = nil if prefixes.blank?
|
||||
parts = name.to_s.split('/')
|
||||
parts.shift if parts.first.empty?
|
||||
name = parts.pop
|
||||
|
||||
return name, prefixes || [""] if parts.empty?
|
||||
|
|
|
@ -201,4 +201,26 @@ module RenderTemplate
|
|||
assert_status 200
|
||||
end
|
||||
end
|
||||
|
||||
module Compatibility
|
||||
class WithoutLayoutController < ActionController::Base
|
||||
self.view_paths = [ActionView::FixtureResolver.new(
|
||||
"test/basic.html.erb" => "Hello from basic.html.erb",
|
||||
"shared.html.erb" => "Elastica"
|
||||
)]
|
||||
|
||||
def with_forward_slash
|
||||
render :template => "/test/basic"
|
||||
end
|
||||
end
|
||||
|
||||
class TestTemplateRenderWithForwardSlash < Rack::TestCase
|
||||
test "rendering a normal template with full path starting with a leading slash" do
|
||||
get "/render_template/compatibility/without_layout/with_forward_slash"
|
||||
|
||||
assert_body "Hello from basic.html.erb"
|
||||
assert_status 200
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue