2011-02-21 32 views
3

我使用設計進行身份驗證。我想用我自己的註冊控制器,而不是內部使用的註冊控制器。於是上去,跟着https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-edit-their-account-without-providing-a-password使用設計自己的註冊控制器

複製從設計的registrations_controller.rb文件(記得控制器從同色器件版本的色器件寶石複製)
這個地點這裏提供的說明,到你的/ app/controllers目錄。
在config/routes.rb中添加:controllers => {:registrations =>「registrations」}給您的devise_for root。
確保您命名該文件registrations_controller.rb
更改第一行:類設計:: RegistrationsController <的ApplicationController類RegistrationsController < ApplicationController的

我用的是色器件版本1.1和我從這裏複製的registrations_controller.rb文件。 https://github.com/plataformatec/devise/blob/v1.1/app/controllers/devise/registrations_controller.rb

現在,當我打的註冊控制器的新動作, 我得到下面的錯誤

NoMethodError (undefined method `new_with_session' for User:Class): 
app/controllers/registrations_controller.rb:71:in `build_resource' 
app/controllers/registrations_controller.rb:8:in `new' 

我registrations_controller.rb長相酷似從那裏我複製了一個。 可能是什麼問題?謝謝。

回答

相關問題