Devise: How to create a new user being already logged in?

后端 未结 8 2087
独厮守ぢ
独厮守ぢ 2021-02-02 16:22

I\'m going to create a multi user app, so, I will have a admin user that will have permission to create new ones.

I\'ve created the UsersControllerbut when

8条回答
  •  礼貌的吻别
    2021-02-02 16:28

    There is another solution.

    You must override registration controller and remove action (or actions) from prepend_before_filter.

    DeviseRegistrationController source is here.

    You can see:

    prepend_before_filter :require_no_authentication, only: [:new, :create, :cancel]
    

    It jumps into require_no_authentication before create method. If you want create new user while you are logged in, just remove :create from array.

提交回复
热议问题