我使用谷歌oauth2時,我登錄使用谷歌,我選擇我的帳戶後,點擊輸入此錯誤顯示。AbstractController ActionNotFound失敗軌道3使用谷歌oauth2
AbstractController::ActionNotFound at /users/auth/google_oauth2/callback
The action 'failure' could not be found for OmniauthCallbacksController
我很難過!我做錯了什麼?
控制器omniauth
class OmniauthCallbacksController < ApplicationController
def google_oauth2
auth_details = request.env["omniauth.auth"]
if auth_details.info['email'].split("@")[1] == "company.net"
user = User.from_omniauth(request.env["omniauth.auth"])
if user.persisted?
flash.notice = "Signed in Through Google!"
sign_in_and_redirect user
else
session["devise.user_attributes"] = user.attributes
flash.notice = "Please provide a password"
redirect_to new_user_registration_url
end
else
render :text => "Sorry this site is for company employees only"
end
end
end
在intializers
/devise.rb 我有config.omniauth要求
痕量
the error show this process actionpack-3.2.13/lib/abstract_controller/base.rb
,這是線它突出顯示
unless action_name = method_for_action(action_name)
raise ActionNotFound, "The action" '#{action}' could not be found for #{self.class.name}"
end
請出示痕跡。 –
嗨,什麼是痕跡?謝謝 –
Naomi,錯誤的回溯。屏幕上沒有失敗的方法,我不知道是什麼代碼調用它。 –