lib/route_downcaser/railtie.rb in route_downcaser-1.1.2 vs lib/route_downcaser/railtie.rb in route_downcaser-1.1.3
- old
+ new
@@ -1,8 +1,12 @@
module RouteDowncaser
class Railtie < Rails::Railtie
initializer "add_downcase_route_middleware" do |app|
- app.config.middleware.use "RouteDowncaser::DowncaseRouteMiddleware"
+ # For some reason, RouteDowncaser needs to be inserted before Devise/Warden, if Devise is used
+ # But since it is not possible to test for the presence of a specific middleware module,
+ # we instead insert RouteDowncaser before a middleware module, that a) is always present
+ # and b) is inserted before Devise/Warden is
+ app.config.middleware.insert_before 'Rack::Head', 'RouteDowncaser::DowncaseRouteMiddleware'
end
end
end