2012-07-31 35 views
0

我想從我的Rails應用程序中刪除註冊頁面,因爲我與只邀請系統打算和我已閱讀,我必須從刪除:registrable模塊爲了讓我的註冊消失頁我的用戶模型...Ruby on Rails的設計:登記刪除回傳失誤

當我做,我得到以下錯誤:

NoMethodError in Devise::RegistrationsController#new 

undefined method `new_with_session' for #<Class:0x007ffb53b8f820> 

這裏是user.r的色器件線b

devise :database_authenticatable, :recoverable, :rememberable, :trackable, :validatable 

回答

1

我想你也必須重寫註冊控制器。從模型登記:

class RegistrationsController < Devise::RegistrationsController 
    def new 
    flash[:info] = 'Registrations are not open yet, but please check back soon' 
    redirect_to root_path 
    end 

    def create 
    flash[:info] = 'Registrations are not open yet, but please check back soon' 
    redirect_to root_path 
    end 
end 

我從disabling Devise registration for production environment only

+0

仍然看不到任何生產或開發服務器的差異...所有的工作是一樣的 – fxuser 2012-08-01 07:35:00

+0

我不得不在控制器文件夾中創建一個設備文件夾,以便它能夠工作謝謝 – fxuser 2012-08-01 08:21:39

1

您只需刪除了它。所描述的錯誤將會發生,直到你重新啓動應用程序爲止

0

嗯,我知道這已經有一段時間了,但它並沒有阻止任何人遇到同樣的問題,因爲我剛剛經歷了幾分鐘前。

最好的解決辦法從模型中取出後:registrable僅僅是重啓您的應用程序,例如

devise :database_authenticatable, :recoverable, :rememberable, :trackable, :validatable, :registrable

成爲

devise :database_authenticatable, :recoverable, :rememberable, :trackable, :validatable

但是,如果您仍然有點想帶人蔘加爲什麼註冊不可用,我會建議任何人去接受接受的答案。

謝謝。