Browse files

Let mail() and create!() return what their overridden versions do.

This allows us to continue to do MailerClass.mailer_method.deliver
  • Loading branch information...
1 parent 4e93240 commit 4ff3e216be882bd37fef4b51222ea41da06a15c9 @einarmagnus einarmagnus committed Mar 14, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/sendgrid.rb
3 lib/sendgrid.rb
@@ -141,14 +141,15 @@ def sendgrid_unique_args(args)
# Sets the custom X-SMTPAPI header after creating the email but before delivery
# NOTE: This override is used for Rails 3 ActionMailer classes.
def mail(headers={}, &block)
- super
+ m = super
if @sg_substitutions && !@sg_substitutions.empty?
@sg_substitutions.each do |find, replace|
raise"Array for #{find} is not the same size as the recipient array") if replace.size != @sg_recipients.size
puts "SendGrid X-SMTPAPI: #{sendgrid_json_headers(message)}" if Object.const_defined?("SENDGRID_DEBUG_OUTPUT") && SENDGRID_DEBUG_OUTPUT
self.headers['X-SMTPAPI'] = sendgrid_json_headers(message)
+ m

0 comments on commit 4ff3e21

Please sign in to comment.