From b786f065d3fc6b0869f7f485042e8667e71ff66d Mon Sep 17 00:00:00 2001 From: Yves Senn Date: Sat, 29 Sep 2012 22:29:29 +0200 Subject: Do not render views when mail() isn't called. (NullMail refactoring) --- actionmailer/lib/action_mailer/base.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'actionmailer/lib') diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index fee4a64248..4d1c697502 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -510,7 +510,19 @@ module ActionMailer 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