這是它應該如何工作的: 我登錄到管理面板,轉到cars/new並填寫字段,按create,我應該有一個新的汽車在我的列表中。 www.autozeep.comrails 3 warden NameError(uncaught throw`warden'):
的事情是,它直到我按創建按鈕來創建新的車,服務器日誌變爲OK表明這一點:
NameError (uncaught throw `warden'):
app/controllers/application_controller.rb:9:in `login_required'
app/middleware/flash_session_cookie_middleware.rb:17:in `call'
在開發模式
這個工作正常,在生產服務器上模式不是,它是相同的代碼,沒有任何改變。 更多的服務器日誌:http://pastie.org/3028350
application_controller
class ApplicationController < ActionController::Base
protect_from_forgery
# filter
def login_required
return true if authenticated?
warden.authenticate!
end
users_controller:http://pastie.org/3028586
我可以編輯的汽車,它工作正常,所以更新和編輯功能從cars_controller都OK,我檢查了新創建函數從cars_controller但我無法處理任何會讓我知道發生了什麼的事情。 Cars_controller:http://pastie.org/3028452
請幫助,我有這個程序allready運行和客戶端si等待這個問題才解決。非常感謝你。
編輯
NameError in CarsController#create
uncaught throw `warden'
Rails.root: /u/apps/zeepauto/releases/20111123173432
Application Trace | Framework Trace | Full Trace
app/controllers/application_controller.rb:9:in `login_required'
app/middleware/flash_session_cookie_middleware.rb:17:in `call'
ENV DUMP
...
....
rack.url_scheme: "http"
rack.version: [1, 0]
warden: Warden::Proxy:-621456458 @config={:default_strategies=>{:_all=>[:database]}, :failure_app=>UsersController, :default_scope=>:default, :scope_defaults=>{}, :intercept_401=>true}
warden.options: {:attempted_path=>"/cars", :action=>"unauthenticated"}
我得到這個錯誤,只有當我添加新的車,我可以編輯的汽車,新聞,聯繫人。除汽車外的所有東西
問題解決了
這個問題通過一些jQuery庫造成的,我使用dynamic_form以這種形式,所以當我在接下來的select_box選擇車名出現所選汽車的型號。檢查問題(我的老師,我不會想到它自己),我們看到,當我選擇汽車時,在日誌中運行名爲「dynamic_carmodels」的過程來更新carmodels列表,並且此時會話密鑰是由另一個更改,通常如果會話密鑰更改,我登錄時啓動的會話不再有效,這就是爲什麼我得到一個「未經驗證的錯誤」。仍然不知道什麼jquery確實是造成這個問題,但最終我得到了這個解決,這不是因爲監獄配置。
你可以發佈你的Gemfile。 – daniel 2011-12-18 22:42:59
它在https://github.com/rmagnum2002/zeepauto – rmagnum2002 2011-12-18 22:45:50