blob: da516c0b858befb26d5579494c76b7f0c5c25185 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
module ActionController
module Layouts
def render_to_string(options)
if !options.key?(:text) || options.key?(:layout)
options[:_layout] = options.key?(:layout) ? _layout_for_option(options[:layout]) : _layout
end
super
end
private
def _layout_for_option(name)
case name
when String then _layout_for_name(name)
when true then _layout
when false then nil
end
end
def _layout_for_name(name)
view_paths.find_by_parts(name, formats, "layouts")
end
def _layout
begin
_layout_for_name(controller_path)
rescue ActionView::MissingTemplate
begin
_layout_for_name("application")
rescue ActionView::MissingTemplate
end
end
end
end
end
|