-
Notifications
You must be signed in to change notification settings - Fork 5.5k
current_user is a Hash in Rails 8.0.2 #5774
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I have the same problem, appears sometimes in my test suite after rails upgrade. |
This is what seems to work for me (
|
Interesting. I'll have to check my config and make sure I'm not doing anything weird. |
The only thing I've seen is that when running in the production environment, Warden doesn't find any authentication strategies in its config, but it does in development. Still searching. |
I'm seeing the same thing -- Warden can't find valid mapping
Adding
To my rails_helper.rb fixes it for now. |
So, I did figure something out. When I first upgraded to Rails 8.0.1 there was a bug which affected route loading. As a result, based on the conversation in #5716 , I changed config.reload_routes = false in config/initializers/devise.rb. Well after upgrading to 8.0.2 that configuration broke it. Merely commenting that out as it had been since I've started using Devise fixed this problem. |
For me, #5774 (comment) is what fixes it (thank you! I spent all day trying to figure this out). Commenting or showing |
We encountered intermittent test failures relating to this (in our case, A handy Devise builds and caches "mappings" (e.g., for :admin) when Devise hooks into ActionDispatch::Routing::RouteSet#finalize! to register these mappings and configure Warden. Configuration can only happen once. If any code triggers For us, the fix was to explicitly eager load the application routes before the controller test, ensuring Devise mappings are registered before |
I upgraded from Rails 8.0.1 to 8.0.2. Noticed the following:
LMK if I can give any other information. Ruby 3.4.2 btw.
The text was updated successfully, but these errors were encountered: