Created
March 21, 2012 18:53
-
-
Save victorbueno/2151241 to your computer and use it in GitHub Desktop.
Background notification
This file contains 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
def background_exception_notification(exception, options={}) | |
if @notifier = Rails.application.config.middleware.detect{ |x| x.klass == ExceptionNotifier } | |
@options = (@notifier.args.first || {}).reverse_merge(self.class.default_options) | |
@exception = exception | |
@backtrace = exception.backtrace || [] | |
@sections = @options[:background_sections] | |
@data = options[:data] || {} | |
@data.each do |name, value| | |
instance_variable_set("@#{name}", value) | |
end | |
subject = compose_subject(exception) | |
mail(:to => @options[:exception_recipients], :from => @options[:sender_address], :subject => subject) do |format| | |
format.text { render "#{mailer_name}/background_exception_notification" } | |
end.deliver | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment