Rails: Redirect after sign in with Devise

后端 未结 6 2016
说谎
说谎 2020-12-14 00:32

Is it possible to redirect users to different pages (based on role) after signing in with Devise? It only seems to redirect to the root :to => ... page defined in routes.rb

6条回答
  •  盖世英雄少女心
    2020-12-14 01:19

    You can use the below code in the application controller or any controller where you need to do the operation:

    def after_sign_in_path_for(resource)
        users_path
    end
    

提交回复
热议问题