diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2008-08-31 19:11:15 +0100 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-08-31 19:17:42 +0100 |
commit | e9a8e0053be3b293ab89fb584f1d660063f107aa (patch) | |
tree | 045661abc41c4cc5123735702d57f6897a3787c1 /actionpack | |
parent | 7ce03db77884e21256ba8f1615ad8dd841b76b86 (diff) | |
download | rails-e9a8e0053be3b293ab89fb584f1d660063f107aa.tar.gz rails-e9a8e0053be3b293ab89fb584f1d660063f107aa.tar.bz2 rails-e9a8e0053be3b293ab89fb584f1d660063f107aa.zip |
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.
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_controller/layout.rb | 6 |
1 files changed, 5 insertions, 1 deletions
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 <tt>layout "weblog/standard"</tt> will return # weblog/standard, but <tt>layout "standard"</tt> 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 |