aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/new_base/layouts.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_controller/new_base/layouts.rb')
-rw-r--r--actionpack/lib/action_controller/new_base/layouts.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/new_base/layouts.rb b/actionpack/lib/action_controller/new_base/layouts.rb
new file mode 100644
index 0000000000..cdf2224e39
--- /dev/null
+++ b/actionpack/lib/action_controller/new_base/layouts.rb
@@ -0,0 +1,19 @@
+module ActionController
+ module Layouts
+ def render_to_string(options)
+ options[:_layout] = options[:layout] || _layout
+ super
+ end
+
+ def _layout
+ begin
+ view_paths.find_by_parts(controller_path, formats, "layouts")
+ rescue ActionView::MissingTemplate
+ begin
+ view_paths.find_by_parts("application", formats, "layouts")
+ rescue ActionView::MissingTemplate
+ end
+ end
+ end
+ end
+end \ No newline at end of file