Created
December 2, 2011 15:39
-
-
Save mguterl/1423669 to your computer and use it in GitHub Desktop.
Silence ActionMailer warnings when using deliver_* class methods
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # The ActionMailer interface in Rails >= 3 sucks. Besides when | |
| # testing the mailer, I see no reason to instantiate an object and | |
| # then deliver it. Extend your mailer with this module to silence the | |
| # warnings and enjoy life once again. | |
| module SilenceDeliverWarnings | |
| def method_missing(method, *args) | |
| if method.to_s =~ /^deliver_(.*)/ | |
| send($1, *args).deliver | |
| else | |
| super | |
| end | |
| end | |
| end | |
| class Mailer < ActionMailer::Base | |
| extend SilenceDeliverWarnings | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment