lib/schneiderlein/engine.rb in schneiderlein-1.1.0 vs lib/schneiderlein/engine.rb in schneiderlein-1.2.0

- old
+ new

@@ -1,11 +1,18 @@ module Schneiderlein class Engine < ::Rails::Engine isolate_namespace Schneiderlein initializer 'schneiderlein.middleware' do |app| - app.config.middleware.insert_before \ - 'ActionDispatch::ParamsParser', 'Schneiderlein::FlyCatcher' + if Rails::VERSION::MAJOR < 5 + app.config.middleware.insert_before \ + 'ActionDispatch::ParamsParser', 'Schneiderlein::FlyCatcher' + else + # ActionDispatch::ParamsParser is not included in the middleware + # stack anymore in Rails 5. + app.config.middleware.insert_after \ + 'ActionDispatch::Callbacks', 'Schneiderlein::FlyCatcher' + end end end end