Open phlegx opened 3 years ago
Found a workaround, add this to application.rb
:
config.before_configuration do |app|
ActiveStorage.draw_routes = false
end
Confirmed this is still an issue on Rails 7.1.0.alpha. The config.before_configuration
didn't work for me, but config.reload_routes = false
in the Devise initializer did solve it. I'm not sure about the conditions where having that enabled would be important, but it seems like an odd default. Also weird that on app.reload_routes!
that the ActiveStorage setting for draw_routes
is ignored. That suggests this might be a Rails bug...
Still an issue Ruby 3.3.3 Rails 7.1.3.4 Devise 4.9.4
I would also be interested in knowing the side effects of Devise.reload_routes = false
too.
Environment
Current behavior
devise
to Gemfile.config.active_storage.draw_routes = false
toconfig/application.rb
.as: rails_service_blob
.RAILS_ENV=staging rails s
. No error on development environment!Expected behavior
Run Rails server as expected. On development environment all works fine. Without Devise installed, server starts fine on all environments.
Found out that
config.eager_load = true
in staging and production environment is the difference to development. Setting eager load to false on staging and production starts the server without crash. But it should work also with eager load set to true.See: https://github.com/heartcombo/devise/blob/5d5636f03ac19e8188d99c044d4b5e90124313af/lib/devise/rails.rb#L17
Setting Devise with
config.reload_routes = false
prevents server crash. But what are the side effects setting this config to false?