【问题标题】:Rails Devise Confirmable - redirectRails 设计可确认 - 重定向
【发布时间】:2016-06-28 10:48:03
【问题描述】:

设计的 Rails 文档说如何重定向的说明不正确:

https://github.com/plataformatec/devise/wiki/How-To:-Add-:confirmable-to-Users#redirecting-user

有人知道怎么做吗?

【问题讨论】:

  • 你试过after_confirmation_path_for吗?

标签: ruby-on-rails devise devise-confirmable


【解决方案1】:

您将需要覆盖设计确认控制器。 在你的 routes.rb 添加这一行

devise_for :users, controllers: { confirmations: 'confirmations' }

在其中创建文件并粘贴此代码

class ConfirmationsController < Devise::ConfirmationsController

  private

  def after_confirmation_path_for(resource_name, resource)
    your_new_after_confirmation_path #your path where you want to land
  end

end

您可能还需要重新启动服务器。

来源:https://github.com/plataformatec/devise/wiki/How-To:-Add-:confirmable-to-Users#redirecting-user

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-10-07
    • 2011-11-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多