0
一切工作正常我的開發機器(Windows XP中,ROR 3.0.3,SQLite3)。設計 - 註冊NoMethodError#新控制器
當我將應用程序移至生產服務器(FreeBSD 8.2-RELEASE,Apache 2.2,ROR 3.0.4,MySQL)時,出現此錯誤,但僅在新的註冊頁面上出現。
當我嘗試登錄(數據庫中沒有用戶)時,密碼檢查似乎工作(它說密碼不正確,這很好)。
問題只發生在生產服務器上,在開發服務器上沒有問題。會是什麼呢?
謝謝!
[編輯]加入2011年9月8日:
routes.rb中:
#USERS
get "/user/stat"
devise_for :users do
get "/login" => "devise/sessions#new"
get "/logout" => "devise/sessions#destroy"
end
get "/users" => "user#index"
resources :user
registations_controller.rb:
# GET /resource/sign_up
def new
build_resource({})
render_with_scope :new
end
protected
# Build a devise resource passing in the session. Useful to move
# temporary session data to the newly created user.
def build_resource(hash=nil)
hash ||= params[resource_name] || {}
self.resource = resource_class.new_with_session(hash, session)
end
日誌/ production.log:
Started GET "https://stackoverflow.com/users/sign_up" for 192.168.5.7 at 2011-08-09 13:40:31 +0400
Processing by Devise::RegistrationsController#new as HTML
SQL (31.7ms) SHOW TABLES
Completed in 33ms
NoMethodError (undefined method `new_with_session' for #<Class:0x284ac6a8>):
app/controllers/registrations_controller.rb:71:in `build_resource'
app/controllers/registrations_controller.rb:8:in `new'
你能發表一些代碼嗎? (registrations_controller,routes.rb和其他設計相關的東西) – David
發佈了一些更多的代碼 –
更新:問題消失了,我不記得如何以及爲什麼。但是這一次它再次出現,我也不明白爲什麼以及如何。 –