aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2019-03-31 19:05:27 +0200
committerGitHub <noreply@github.com>2019-03-31 19:05:27 +0200
commit563bf5771fb8bf3c8458393cd5a42bab7a5b6f1e (patch)
tree385a040c662cf3f8981fac536ce6b6bacbd510f3
parent002684e36e813469c3585e193f0698784c88278b (diff)
parent6841d0cc6d19002f3f85343d582310756aadf2c1 (diff)
downloadrails-563bf5771fb8bf3c8458393cd5a42bab7a5b6f1e.tar.gz
rails-563bf5771fb8bf3c8458393cd5a42bab7a5b6f1e.tar.bz2
rails-563bf5771fb8bf3c8458393cd5a42bab7a5b6f1e.zip
Merge pull request #35793 from jhawthorn/deprecate_layout_absolute_path
Deprecate render layout with an absolute path
-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 60cb2ceafa..698f535b49 100644
--- a/actionview/lib/action_view/renderer/template_renderer.rb
+++ b/actionview/lib/action_view/renderer/template_renderer.rb
@@ -89,6 +89,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