From e9a8e0053be3b293ab89fb584f1d660063f107aa Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Sun, 31 Aug 2008 19:11:15 +0100 Subject: Add layout functionality to mailers. Mailer layouts behaves just like controller layouts, except layout names need to have '_mailer' postfix for them to be automatically picked up. --- actionpack/lib/action_controller/layout.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'actionpack/lib/action_controller') diff --git a/actionpack/lib/action_controller/layout.rb b/actionpack/lib/action_controller/layout.rb index 66e9997ae0..cf066eba64 100644 --- a/actionpack/lib/action_controller/layout.rb +++ b/actionpack/lib/action_controller/layout.rb @@ -216,7 +216,7 @@ module ActionController #:nodoc: # object). If the layout was defined without a directory, layouts is assumed. So layout "weblog/standard" will return # weblog/standard, but layout "standard" will return layouts/standard. def active_layout(passed_layout = nil) - layout = passed_layout || self.class.default_layout(response.template.template_format) + layout = passed_layout || self.class.default_layout(default_template_format) active_layout = case layout when String then layout when Symbol then send!(layout) @@ -276,5 +276,9 @@ module ActionController #:nodoc: rescue ActionView::MissingTemplate false end + + def default_template_format + response.template.template_format + end end end -- cgit v1.2.3