Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Background notification
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