How do I remove the Devise route to sign up?

后端 未结 15 2415
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-07 07:36

I\'m using Devise in a Rails 3 app, but in this case, a user must be created by an existing user, who determines what permissions he/she will have.

Because of this, I

15条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-07 08:32

    For others in my case.
    With devise (3.5.2).
    I successfully removed the routes to signup, but kept the ones to edit the profile, with the following code.

    #routes.rb
    devise_for :users, skip: [:registrations]
    as :user do
      get 'users/edit' => 'devise/registrations#edit', :as => 'edit_user_registration'
      put '/users(.:format)' => 'devise/registrations#update', as: 'user_registration'
      patch '/users(.:format)' => 'devise/registrations#update'
    end
    

提交回复
热议问题