From 890321e51e0c51f61f9198d247727e98f7485899 Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Thu, 19 Mar 2009 15:45:48 -0700 Subject: Get very basic layouts working. * Required small architecture change --- actionpack/lib/action_controller/new_base/layouts.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 actionpack/lib/action_controller/new_base/layouts.rb (limited to 'actionpack/lib/action_controller/new_base/layouts.rb') 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 -- cgit v1.2.3