2013-10-04 67 views
0

我在我的web應用程序中使用omniauth。我正在嘗試捕獲omniauth失敗(Permission denied Error)異常。我提到這篇文章。 How to rescue OmniAuth::Strategies::OAuth2::CallbackError?未定義的方法'行動'的控制器

我在我的初始化程序中有此代碼。

OmniAuth.config.on_failure = Proc.new do |env| 
    UserSessionsController.action(:omniauth_failure).call(env) 
    end 

我收到此錯誤:

undefined method `action' for UserSessionsController:Class 

誰能幫助我嗎?我正在使用紅寶石1.8.7和軌道2.3.8

+2

您正在參考的帖子是在您使用RoR 2應用程序時談到RoR 3應用程序。我想這就是問題所在。 – Arjan

+0

有沒有什麼辦法可以在RoR2中實現這個功能? – jithendhir92

+1

這似乎是'OmniAuth'沒有設計用於Rails 2.3.x的版本(http://stackoverflow.com/questions/6686780/how-to-use-omniauth-properly-with-rails -2)。 – lurker

回答

0
OmniAuth.config.on_failure = Proc.new do |env| 
    # https://github.com/intridea/omniauth/blob/d02f9d58f70f132c856199470f94b93c852d9bb0/lib/omniauth/failure_endpoint.rb 
    # line no 29,30,31 
end 
相關問題