1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Add support for stripping "layouts/" from the layout name

This commit is contained in:
Yehuda Katz + Carl Lerche 2009-05-01 16:02:37 -07:00
parent b4903a8e34
commit 918b119bd3
2 changed files with 8 additions and 0 deletions

View file

@ -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}"

View file

@ -8,5 +8,10 @@ module ActionController
super
end
def _layout_for_name(name)
name &&= name.sub(%r{^/?layouts/}, '')
super
end
end
end