【问题标题】:When migrating from restful_authentication to Devise do I need to change the sessions and user controller?从 restful_authentication 迁移到 Devise 时,我需要更改会话和用户控制器吗?
【发布时间】:2011-09-24 10:37:24
【问题描述】:

当我从 restful_authentication 迁移到设计时,它会显示主页,但随后它抱怨它找不到 restful_authentication 命令。我需要做什么来解决这个问题?我需要更换用户和会话控制器吗?

【问题讨论】:

    标签: ruby ruby-on-rails-3 devise restful-authentication controllers


    【解决方案1】:

    Devise 会生成新的用户控制器,会话控制器没问题。您必须确保删除 Application_controller 中的所有 restful_authentications 链接等等,然后您必须在 routes.rb 中将资源 :users 更改为 devise_for :users 然后它应该进行一些调整,例如将根设置为另一个控制器并添加 before_filter :authenticate_user!到该模型,以便它转到登录屏幕(假设您需要此功能)。

    【讨论】:

    • 什么是restful认证链接?你有他们的名单吗?应该如何用设计链接替换它?
    【解决方案2】:

    对于从 restful_authentication 迁移到 devise,devise wiki 页面将对您有所帮助。

    访问https://github.com/plataformatec/devise/wiki/How-To:-Migrate-from-restful_authentication-to-Devise

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-04-26
      • 1970-01-01
      • 1970-01-01
      • 2013-05-07
      • 1970-01-01
      • 1970-01-01
      • 2012-01-08
      相关资源
      最近更新 更多