Skip to content
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

deprecation warning: resource received a hash argument * Please use a keyword instead #5735

Open
wdiechmann opened this issue Dec 2, 2024 · 0 comments

Comments

@wdiechmann
Copy link

Environment

  • Ruby 3.3.3
  • Rails 8.1.0.alpha
  • Devise 4.9.4

Current behavior

Strangely enough this only is reported in test ?!

√ bellis % rails test test/services/dinero_service_test.rb 
DEPRECATION WARNING: resource received a hash argument only. Please use a keyword instead. (called from block in <main> at /Users/walther/Deling/Walther/src/mortimer/redbox/bellis/config/routes.rb:4)
DEPRECATION WARNING: resource received a hash argument path. Please use a keyword instead. (called from block in <main> at /Users/walther/Deling/Walther/src/mortimer/redbox/bellis/config/routes.rb:4)
DEPRECATION WARNING: resource received a hash argument path_names. Please use a keyword instead. (called from block in <main> at /Users/walther/Deling/Walther/src/mortimer/redbox/bellis/config/routes.rb:4)
DEPRECATION WARNING: resource received a hash argument controller. Please use a keyword instead. (called from block in <main> at /Users/walther/Deling/Walther/src/mortimer/redbox/bellis/config/routes.rb:4)
DEPRECATION WARNING: resource received a hash argument only. Please use a keyword instead. (called from block in <main> at /Users/walther/Deling/Walther/src/mortimer/redbox/bellis/config/routes.rb:4)
DEPRECATION WARNING: resource received a hash argument path. Please use a keyword instead. (called from block in <main> at /Users/walther/Deling/Walther/src/mortimer/redbox/bellis/config/routes.rb:4)
DEPRECATION WARNING: resource received a hash argument path_names. Please use a keyword instead. (called from block in <main> at /Users/walther/Deling/Walther/src/mortimer/redbox/bellis/config/routes.rb:4)
DEPRECATION WARNING: resource received a hash argument controller. Please use a keyword instead. (called from block in <main> at /Users/walther/Deling/Walther/src/mortimer/redbox/bellis/config/routes.rb:4)
Running 5 tests in a single process (parallelization threshold is 50)
Run options: --seed 28000

The warnings go away if I comment this in config/routes.rb


  devise_for :users, controllers: {
    invitations: "users/invitations",
    registrations: "users/registrations",
    sessions: "users/sessions",
    confirmations: "users/confirmations",
    passwords: "users/passwords",
    unlocks: "users/unlocks",
    omniauth_callbacks: "users/omniauth_callbacks"
  }

Cannot find anything on SO and neither in the Devise repo ?

Not sure what keyword I should use - trying to follow Devise documented config

* controllers: the controller which should be used. All routes by default points to Devise controllers.
  However, if you want them to point to custom controller, you should do:

    devise_for :users, controllers: { sessions: "users/sessions" }

My wrong doing ?

Expected behavior

I would not expect any deprecation warnings at all (eg. none seen when running dev )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant