在首次登录路径后设计导轨

时间:2012-09-01 19:14:09

标签: ruby-on-rails-3 devise

我们是否有办法在注册后配置设备以转到特定页面?像after_sign_up_path这样的东西。我希望用户在注册后首次登录时更新其个人资料,因此希望将其重定向到edit_user_path(current_user)

2 个答案:

答案 0 :(得分:0)

知道了。以下是我实施它的方式。

scope = Devise::Mapping.find_scope!(user)
sign_in(scope, user, {})
redirect_to edit_user_path(current_user)

答案 1 :(得分:0)

不确定你是否已经知道 但是有一种after_sign_up_path_for方法,您现在可以覆盖它 https://github.com/plataformatec/devise/blob/master/app/controllers/devise/registrations_controller.rb#L98