【发布时间】:2011-09-24 10:37:24
【问题描述】:
当我从 restful_authentication 迁移到设计时,它会显示主页,但随后它抱怨它找不到 restful_authentication 命令。我需要做什么来解决这个问题?我需要更换用户和会话控制器吗?
【问题讨论】:
标签: ruby ruby-on-rails-3 devise restful-authentication controllers
当我从 restful_authentication 迁移到设计时,它会显示主页,但随后它抱怨它找不到 restful_authentication 命令。我需要做什么来解决这个问题?我需要更换用户和会话控制器吗?
【问题讨论】:
标签: ruby ruby-on-rails-3 devise restful-authentication controllers
Devise 会生成新的用户控制器,会话控制器没问题。您必须确保删除 Application_controller 中的所有 restful_authentications 链接等等,然后您必须在 routes.rb 中将资源 :users 更改为 devise_for :users 然后它应该进行一些调整,例如将根设置为另一个控制器并添加 before_filter :authenticate_user!到该模型,以便它转到登录屏幕(假设您需要此功能)。
【讨论】:
对于从 restful_authentication 迁移到 devise,devise wiki 页面将对您有所帮助。
访问https://github.com/plataformatec/devise/wiki/How-To:-Migrate-from-restful_authentication-to-Devise
【讨论】: