diff options
Diffstat (limited to 'actionmailer/lib')
-rw-r--r-- | actionmailer/lib/action_mailer/base.rb | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 19ce77ea5a..e41c88d81b 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -549,7 +549,12 @@ module ActionMailer #:nodoc: end def render_message(method_name, body) + if method_name.respond_to?(:content_type) + @current_template_content_type = method_name.content_type + end render :file => method_name, :body => body + ensure + @current_template_content_type = nil end def render(opts) @@ -568,7 +573,11 @@ module ActionMailer #:nodoc: end def default_template_format - :html + if @current_template_content_type + Mime::Type.lookup(@current_template_content_type).to_sym + else + :html + end end def candidate_for_layout?(options) @@ -588,7 +597,9 @@ module ActionMailer #:nodoc: end def initialize_template_class(assigns) - ActionView::Base.new(view_paths, assigns, self) + template = ActionView::Base.new(view_paths, assigns, self) + template.template_format = default_template_format + template end def sort_parts(parts, order = []) |