aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_controller/abstract/layouts.rb3
-rw-r--r--actionpack/lib/action_controller/new_base/compatibility.rb5
2 files changed, 8 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/abstract/layouts.rb b/actionpack/lib/action_controller/abstract/layouts.rb
index f56b9dd914..eb3b73289d 100644
--- a/actionpack/lib/action_controller/abstract/layouts.rb
+++ b/actionpack/lib/action_controller/abstract/layouts.rb
@@ -57,6 +57,9 @@ module AbstractController
def _layout() end # This will be overwritten
+ # :api: plugin
+ # ====
+ # Override this to mutate the inbound layout name
def _layout_for_name(name)
unless [String, FalseClass, NilClass].include?(name.class)
raise ArgumentError, "String, false, or nil expected; you passed #{name.inspect}"
diff --git a/actionpack/lib/action_controller/new_base/compatibility.rb b/actionpack/lib/action_controller/new_base/compatibility.rb
index 8682493c8e..275a18abfd 100644
--- a/actionpack/lib/action_controller/new_base/compatibility.rb
+++ b/actionpack/lib/action_controller/new_base/compatibility.rb
@@ -8,5 +8,10 @@ module ActionController
super
end
+ def _layout_for_name(name)
+ name &&= name.sub(%r{^/?layouts/}, '')
+ super
+ end
+
end
end \ No newline at end of file