How to pass through parameters during Devise login

我的未来我决定 提交于 2019-12-05 18:51:26
Hoang Nghiem

I think you can create a profile action within the UsersController which does a redirect to the user show page, then mark it as user root.

In UsersController:

class UsersController < ApplicationController
  ...
  def profile
    redirect_to user_url(:id => current_user.username)
  end
  ...
end

In routes:

resources :users do
  get 'profile', :on => :collection, :as => :user_root
end

And don't need to use the after_sign_in_path hook.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!