aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/new_base/layouts.rb
diff options
context:
space:
mode:
authorYehuda Katz <wycats@gmail.com>2009-03-19 15:45:48 -0700
committerYehuda Katz <wycats@gmail.com>2009-03-19 15:45:48 -0700
commit890321e51e0c51f61f9198d247727e98f7485899 (patch)
tree19457c8d5e9bff3d3b3b16fc4861964e5297957c /actionpack/lib/action_controller/new_base/layouts.rb
parent8ab37c76608d7105c47566e79b85fcf72cb11e4b (diff)
downloadrails-890321e51e0c51f61f9198d247727e98f7485899.tar.gz
rails-890321e51e0c51f61f9198d247727e98f7485899.tar.bz2
rails-890321e51e0c51f61f9198d247727e98f7485899.zip
Get very basic layouts working.
* Required small architecture change
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