Override devise registrations controller

前端 未结 5 1793
渐次进展
渐次进展 2020-11-22 00:05

I have added a field to the sign-up form that is based on a different model, see How do I use nested attributes with the devise model for the gory details. This part is work

5条回答
  •  不要未来只要你来
    2020-11-22 01:05

    Very simple methods Just go to the terminal and the type following

    rails g devise:controllers users //This will create devise controllers in controllers/users folder
    

    Next to use custom views

    rails g devise:views users //This will create devise views in views/users folder
    

    now in your route.rb file

    devise_for :users, controllers: {
               :sessions => "users/sessions",
               :registrations => "users/registrations" }
    

    You can add other controllers too. This will make devise to use controllers in users folder and views in users folder.

    Now you can customize your views as your desire and add your logic to controllers in controllers/users folder. Enjoy !

提交回复
热议问题