diff options
author | Yves Senn <yves.senn@gmail.com> | 2012-09-29 22:29:29 +0200 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2012-10-28 20:45:43 +0100 |
commit | b786f065d3fc6b0869f7f485042e8667e71ff66d (patch) | |
tree | 703e918d99de02f946898f019a74c1be5eff359e /actionmailer/lib | |
parent | 2e44dda27ae8df9301b1a83bfaa74708678bfcd4 (diff) | |
download | rails-b786f065d3fc6b0869f7f485042e8667e71ff66d.tar.gz rails-b786f065d3fc6b0869f7f485042e8667e71ff66d.tar.bz2 rails-b786f065d3fc6b0869f7f485042e8667e71ff66d.zip |
Do not render views when mail() isn't called. (NullMail refactoring)
Diffstat (limited to 'actionmailer/lib')
-rw-r--r-- | actionmailer/lib/action_mailer/base.rb | 14 |
1 files changed, 13 insertions, 1 deletions
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 |