1

I get this error trying to run a local rails server for an app upgraded to Rails 5.2 beta2:

gems/actionpack-5.2.0.beta2/lib/action_dispatch/middleware/stack.rb:108:in `assert_index': No such middleware to insert before: "Warden::Manager" (RuntimeError)

I am using Devise.

Update: Error is related to apartment gem with Devise on Rails 5.2. This line in initializers/apartment.rb

Rails.application.config.middleware.insert_before 'Warden::Manager', 'Apartment::Elevators::Subdomain'

Seems to be related. It works fine with Rails 4.10

rigyt
  • 2,219
  • 3
  • 28
  • 40

1 Answers1

1

This was fixed by changing the class name strings to reference the actual classes in the apartment initializer:

Rails.application.config.middleware.use Apartment::Elevators::Subdomain
Rails.application.config.middleware.insert_before Warden::Manager, Apartment::Elevators::Subdomain
rigyt
  • 2,219
  • 3
  • 28
  • 40
  • if there is another error `uninitialized constant Apartment::Elevators (NameError)` just add `require 'apartment/elevators/subdomain'` to the top of your `application.rb`. – Kiry Meas Nov 24 '22 at 03:45