From 37586ddf279c46c3d0c8c2553d0918aa82ceb020 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Sun, 28 Oct 2012 12:55:53 -0700 Subject: Merge pull request #8048 from senny/7761_dont_render_view_without_mail_call Do not render views when mail() isn't called. (NullMail refactoring) Conflicts: actionmailer/CHANGELOG.md --- actionmailer/lib/action_mailer/base.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'actionmailer/lib/action_mailer') diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 2a11cb6ca7..a9fb49a303 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -454,7 +454,19 @@ module ActionMailer #:nodoc: def process(*args) #:nodoc: lookup_context.skip_default_locale! - super + + generated_mail = super + unless generated_mail + @_message = NullMail.new + end + end + + class NullMail #:nodoc: + def body; '' end + + def method_missing(*args) + nil + end end def mailer_name -- cgit v1.2.3