我有類用戶:: OmniauthCallbacksController <設計:: OmniauthCallbacksController ,我重寫after_omniauth_failure_path_for方法:無法覆蓋after_omniauth_failure_path_for在設計
protected
def after_omniauth_failure_path_for resource
'/report_failure'
end
但超級之一是,被稱爲之一。
我懷疑,這是因爲中繼解決方法:
devise_for :users do
get '/users/auth/:provider' => 'users/omniauth_callbacks#passthru'
end
有誰知道如何解決這個問題? 我使用的設計2.0.4
這是日誌文件報告:
Started GET "https://stackoverflow.com/users/auth/facebook/callback?error_reason=user_denied&error=access_denied&error_description=The+user+denied+your+request." for 77.124.184.115 at 2012-04-19 11:34:46 +0000
Processing by Devise::OmniauthCallbacksController#failure as HTML
Parameters: {"error_reason"=>"user_denied", "error"=>"access_denied", "error_description"=>"The user denied your request."}
Redirected to http://myapp.com/users/sign_in
Completed 302 Found in 1ms (ActiveRecord: 0.0ms)
編輯:如果我刪除了中繼重定向,那麼它的工作原理:
# def devise_for :users do
# get '/users/auth/:provider' => 'users/omniauth_callbacks#passthru'
# end
謝謝
你的錯誤信息告訴你Devise甚至不使用你的'OmniauthCallbacksController',它使用它自己的。我認爲@ the8472是對的。你發佈的代碼不會顯示你設置':omniauth_callbacks =>「users/omniauth_callbacks」' – declan 2012-04-29 18:08:31