Skip to content

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

@wdiechmann

Description

@wdiechmann

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 )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions