Permalink
Browse files

use pony instead of action-mailer if loaded

  • Loading branch information...
1 parent 83d727f commit 8041e0c6f28c5f43aba1bd7a365c94829d694043 @mkristian committed Dec 18, 2012
Showing with 27 additions and 12 deletions.
  1. +21 −8 lib/ixtlan/errors/mailer.rb
  2. +6 −4 lib/ixtlan/errors/railtie.rb
@@ -1,14 +1,27 @@
module Ixtlan
module Errors
- class Mailer < ActionMailer::Base
+ if defined? Pony
+
+ class Mailer
+ def error_notification(email_from, emails_to, exception, error_url)
+ Pony.mail( :from => email_from,
+ :to => emails_to,
+ :subject => exception.message,
+ :body => "#{error_url}" )
+ end
+ end
+
+ else
+ class Mailer < ActionMailer::Base
- def error_notification(email_from, emails_to, exception, error_url)
- @subject = exception.message
- @text = "#{error_url}"
- @recipients = emails_to
- @from = email_from
- @sent_on = Time.now
- @headers = {}
+ def error_notification(email_from, emails_to, exception, error_url)
+ @subject = exception.message
+ @text = "#{error_url}"
+ @recipients = emails_to
+ @from = email_from
+ @sent_on = Time.now
+ @headers = {}
+ end
end
end
end
@@ -8,10 +8,12 @@ module Errors
class Railtie < Rails::Railtie
config.before_configuration do |app|
-
- path = File.join(File.dirname(__FILE__), "..", "..")
- unless ActionMailer::Base.view_paths.member? path
- ActionMailer::Base.view_paths= [ActionMailer::Base.view_paths, path].flatten
+
+ unless defined? Pony
+ path = File.join(File.dirname(__FILE__), "..", "..")
+ unless ActionMailer::Base.view_paths.member? path
+ ActionMailer::Base.view_paths= [ActionMailer::Base.view_paths, path].flatten
+ end
end
app.config.error_dumper = ErrorDumper.new

0 comments on commit 8041e0c

Please sign in to comment.