Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@tombruijn
Last active May 5, 2017 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tombruijn/c2029c907e7322977f29cc26816da390 to your computer and use it in GitHub Desktop.
Save tombruijn/c2029c907e7322977f29cc26816da390 to your computer and use it in GitHub Desktop.
AppSignal Rails 5.1 workaround
# 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