当我使用谷歌登录时,我正在使用谷歌 oauth2,在我选择我的帐户并点击输入后出现此错误。
AbstractController::ActionNotFound at /users/auth/google_oauth2/callback
The action 'failure' could not be found for OmniauthCallbacksController
我好难过!我做错了什么?
全域认证控制器
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