Last active
May 5, 2017 14:19
-
-
Save tombruijn/c2029c907e7322977f29cc26816da390 to your computer and use it in GitHub Desktop.
AppSignal Rails 5.1 workaround
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
# config/application.rb | |
# Workaround for making the AppSignal gem work on Rails 5.1. | |
# Put this after your Rails app module is defined. | |
# E.g. `module TestApp; class Application < Rails::Application`. | |
# Safest location being at the end of the `config/application.rb` file. | |
# Create a new middleware class with a different name so that when the original | |
# middleware is deleted the newly added one isn't deleted as well, since Rails | |
# deletes the middleware by name. | |
class Appsignal::Rack::Rails51Instrumentation < Appsignal::Rack::RailsInstrumentation | |
end | |
# Delete original middleware | |
Rails.application.config.middleware.delete Appsignal::Rack::RailsInstrumentation | |
# Add the middleware in a new location where it can capture and record the | |
# error before Rails renders an error page. | |
Rails.application.config.middleware.insert_after( | |
ActionDispatch::DebugExceptions, | |
Appsignal::Rack::Rails51Instrumentation | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment