aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-01-17 09:14:17 -0200
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-01-17 10:04:39 -0200
commite5e9a4cc7615a8b60cd90d8754231df709f39e6c (patch)
tree3ff0a37d81d3f190fd5263bf57d6ff0861712682 /actionpack
parent0b7548fab17c8f50d9bc6ed7e98ef475d73010cc (diff)
downloadrails-e5e9a4cc7615a8b60cd90d8754231df709f39e6c.tar.gz
rails-e5e9a4cc7615a8b60cd90d8754231df709f39e6c.tar.bz2
rails-e5e9a4cc7615a8b60cd90d8754231df709f39e6c.zip
Bring back rendering templates that start with / in nested structures
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_view/lookup_context.rb1
-rw-r--r--actionpack/test/controller/new_base/render_template_test.rb22
2 files changed, 23 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/lookup_context.rb b/actionpack/lib/action_view/lookup_context.rb
index 90d88ca967..90c4a2759a 100644
--- a/actionpack/lib/action_view/lookup_context.rb
+++ b/actionpack/lib/action_view/lookup_context.rb
@@ -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?
diff --git a/actionpack/test/controller/new_base/render_template_test.rb b/actionpack/test/controller/new_base/render_template_test.rb
index 88f8cc0d6e..ade204c387 100644
--- a/actionpack/test/controller/new_base/render_template_test.rb
+++ b/actionpack/test/controller/new_base/render_template_test.rb
@@ -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