Skip to content

devise_for parameter format not working as expected #5500

Closed
@ClearlyClaire

Description

Environment

  • Ruby 3.0.4p208
  • Rails 6.1.6
  • Devise 4.8.1

Current behavior

When calling devise_for with a format: false parameter, i.e.:

# frozen_string_literal: true

Rails.application.routes.draw do
  devise_for :users, format: false, path: 'auth'
end

The generated routes include (.:format):

$ bundle exec rails routes
                  Prefix Verb   URI Pattern                      Controller#Action
        new_user_session GET    /auth/sign_in(.:format)          devise/sessions#new {:format=>false}
            user_session POST   /auth/sign_in(.:format)          devise/sessions#create {:format=>false}
    destroy_user_session DELETE /auth/sign_out(.:format)         devise/sessions#destroy {:format=>false}
       new_user_password GET    /auth/password/new(.:format)     devise/passwords#new {:format=>false}
      edit_user_password GET    /auth/password/edit(.:format)    devise/passwords#edit {:format=>false}
           user_password PATCH  /auth/password(.:format)         devise/passwords#update {:format=>false}
                         PUT    /auth/password(.:format)         devise/passwords#update {:format=>false}
                         POST   /auth/password(.:format)         devise/passwords#create {:format=>false}
cancel_user_registration GET    /auth/cancel(.:format)           devise/registrations#cancel {:format=>false}
   new_user_registration GET    /auth/sign_up(.:format)          devise/registrations#new {:format=>false}
  edit_user_registration GET    /auth/edit(.:format)             devise/registrations#edit {:format=>false}
       user_registration PATCH  /auth(.:format)                  devise/registrations#update {:format=>false}
                         PUT    /auth(.:format)                  devise/registrations#update {:format=>false}
                         DELETE /auth(.:format)                  devise/registrations#destroy {:format=>false}
                         POST   /auth(.:format)                  devise/registrations#create {:format=>false}
   new_user_confirmation GET    /auth/confirmation/new(.:format) devise/confirmations#new {:format=>false}
       user_confirmation GET    /auth/confirmation(.:format)     devise/confirmations#show {:format=>false}
                         POST   /auth/confirmation(.:format)     devise/confirmations#create {:format=>false}

Expected behavior

I would expect format: false to result in the following:

                  Prefix Verb   URI Pattern            Controller#Action
        new_user_session GET    /auth/sign_in          devise/sessions#new
            user_session POST   /auth/sign_in          devise/sessions#create
    destroy_user_session DELETE /auth/sign_out         devise/sessions#destroy
       new_user_password GET    /auth/password/new     devise/passwords#new
      edit_user_password GET    /auth/password/edit    devise/passwords#edit
           user_password PATCH  /auth/password         devise/passwords#update
                         PUT    /auth/password         devise/passwords#update
                         POST   /auth/password         devise/passwords#create
cancel_user_registration GET    /auth/cancel           devise/registrations#cancel
   new_user_registration GET    /auth/sign_up          devise/registrations#new
  edit_user_registration GET    /auth/edit             devise/registrations#edit
       user_registration PATCH  /auth                  devise/registrations#update
                         PUT    /auth                  devise/registrations#update
                         DELETE /auth                  devise/registrations#destroy
                         POST   /auth                  devise/registrations#create
   new_user_confirmation GET    /auth/confirmation/new devise/confirmations#new
       user_confirmation GET    /auth/confirmation     devise/confirmations#show
                         POST   /auth/confirmation     devise/confirmations#create

Activity

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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions