I have set up a new application with Devise and Apartment. I was facing an error
`.rvm/gems/ruby-3.4.9/gems/actionpack-8.1.3/lib/action_dispatch/middleware/stack.rb:44:in 'ActionDispatch::MiddlewareStack::Middleware#build': undefined method 'new' for an instance of String (NoMethodError)
klass.new(app, *args, &block)
^^^^
Did you mean? next`
After hours of investigation, I found a simple issue. Just fixed on local, but don't know what will happen in production.
../.rvm/gems/ruby-3.4.9/gems/apartment-0.24.3/lib/apartment/railtie.rb
+46 line
if Rails.env.development?
# Apartment::Reloader is middleware to initialize things properly on each request to dev
initializer 'apartment.init' do |app|
#**app.config.middleware.use "Apartment::Reloader"**
#changed to
app.config.middleware.use Apartment::Reloader
end
# Overrides reload! to also call Apartment::Database.init as well so that the reloaded classes have the proper table_names
console do
require 'apartment/console'
end
end
I have set up a new application with Devise and Apartment. I was facing an error
`.rvm/gems/ruby-3.4.9/gems/actionpack-8.1.3/lib/action_dispatch/middleware/stack.rb:44:in 'ActionDispatch::MiddlewareStack::Middleware#build': undefined method 'new' for an instance of String (NoMethodError)
Did you mean? next`
After hours of investigation, I found a simple issue. Just fixed on local, but don't know what will happen in production.
../.rvm/gems/ruby-3.4.9/gems/apartment-0.24.3/lib/apartment/railtie.rb
+46 line
if Rails.env.development?
#changed toapp.config.middleware.use Apartment::Reloader
end