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:
parent
b4903a8e34
commit
918b119bd3
2 changed files with 8 additions and 0 deletions
|
@ -57,6 +57,9 @@ module AbstractController
|
||||||
|
|
||||||
def _layout() end # This will be overwritten
|
def _layout() end # This will be overwritten
|
||||||
|
|
||||||
|
# :api: plugin
|
||||||
|
# ====
|
||||||
|
# Override this to mutate the inbound layout name
|
||||||
def _layout_for_name(name)
|
def _layout_for_name(name)
|
||||||
unless [String, FalseClass, NilClass].include?(name.class)
|
unless [String, FalseClass, NilClass].include?(name.class)
|
||||||
raise ArgumentError, "String, false, or nil expected; you passed #{name.inspect}"
|
raise ArgumentError, "String, false, or nil expected; you passed #{name.inspect}"
|
||||||
|
|
|
@ -8,5 +8,10 @@ module ActionController
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def _layout_for_name(name)
|
||||||
|
name &&= name.sub(%r{^/?layouts/}, '')
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
Loading…
Reference in a new issue