aboutsummaryrefslogtreecommitdiffstats
path: root/actionview
diff options
context:
space:
mode:
authorJohn Hawthorn <john@hawthorn.email>2019-03-29 11:04:16 -0700
committerJohn Hawthorn <john@hawthorn.email>2019-03-29 11:39:40 -0700
commit6841d0cc6d19002f3f85343d582310756aadf2c1 (patch)
treeb8a69e8800023a916b13fd6e24273e31420effa8 /actionview
parentf1688bf6b0ef4adb44f6f71a83f5dcbac06ebf3a (diff)
downloadrails-6841d0cc6d19002f3f85343d582310756aadf2c1.tar.gz
rails-6841d0cc6d19002f3f85343d582310756aadf2c1.tar.bz2
rails-6841d0cc6d19002f3f85343d582310756aadf2c1.zip
Deprecate render layout with an absolute path
This has similar problems to render file:. I've never seen this used, and believe it's a relic from when all templates could be rendered from an absolute path.
Diffstat (limited to 'actionview')
-rw-r--r--actionview/lib/action_view/renderer/template_renderer.rb1
-rw-r--r--actionview/test/actionpack/controller/layout_test.rb4
2 files changed, 4 insertions, 1 deletions
diff --git a/actionview/lib/action_view/renderer/template_renderer.rb b/actionview/lib/action_view/renderer/template_renderer.rb
index 9548fe12c4..e722721229 100644
--- a/actionview/lib/action_view/renderer/template_renderer.rb
+++ b/actionview/lib/action_view/renderer/template_renderer.rb
@@ -84,6 +84,7 @@ module ActionView
when String
begin
if layout.start_with?("/")
+ ActiveSupport::Deprecation.warn "Rendering layouts from an absolute path is deprecated."
@lookup_context.with_fallbacks.find_template(layout, nil, false, [], details)
else
@lookup_context.find_template(layout, nil, false, [], details)
diff --git a/actionview/test/actionpack/controller/layout_test.rb b/actionview/test/actionpack/controller/layout_test.rb
index 838b564c5d..f946e4360d 100644
--- a/actionview/test/actionpack/controller/layout_test.rb
+++ b/actionview/test/actionpack/controller/layout_test.rb
@@ -233,7 +233,9 @@ class LayoutSetInResponseTest < ActionController::TestCase
def test_absolute_pathed_layout
@controller = AbsolutePathLayoutController.new
- get :hello
+ assert_deprecated do
+ get :hello
+ end
assert_equal "layout_test.erb hello.erb", @response.body.strip
end
end