2012-02-21 27 views
2

我想佈局設置爲我設計登錄頁面,所以我增加了以下我的ApplicationController:缺少幫手「devise_controller?」在ApplicationController中

class ApplicationController < ActionController::Base 
    protect_from_forgery 

    if devise_controller? 
    layout "single_column_with_banner" 
    end 
end 

不過,我得到以下錯誤: 未定義的方法`devise_controller」對於ApplicationController中:

類我可以看到,輔助方法是devise.rb規定,但我不能從應用控制器訪問它。我正在使用Rails 3.2(從2.3遷移過程中)。我應該看哪些線索?作爲最後的手段,我可​​以重寫SessionsController,但我不想那麼做。

回答

1

好像佈局可以在沒有任何device_controller指定?或者覆蓋SessionsController。爲了指定佈局,請將以下內容放入application.rb

config.to_prepare do 
    Devise::SessionsController.layout "single_column_with_banner" 
end