Ruby on rails 未定义的方法跳过\u确认!-设计
尝试在heroku上托管的应用程序上使用Desive、omniauth(包括facebook omniauth)设置facebook身份验证。 对FacebookAPI的调用是有效的,但我并没有设法跳过回调后的确认步骤 我遵循了关于omniauth的github教程: 并阅读并尝试实现以下内容: 但我的heroku日志中不断出现以下错误:Ruby on rails 未定义的方法跳过\u确认!-设计,ruby-on-rails,devise,omniauth,Ruby On Rails,Devise,Omniauth,尝试在heroku上托管的应用程序上使用Desive、omniauth(包括facebook omniauth)设置facebook身份验证。 对FacebookAPI的调用是有效的,但我并没有设法跳过回调后的确认步骤 我遵循了关于omniauth的github教程: 并阅读并尝试实现以下内容: 但我的heroku日志中不断出现以下错误: NoMethodError (undefined method `skip_confirmation!') 下面是我的designe.rb的外观: con
NoMethodError (undefined method `skip_confirmation!')
下面是我的designe.rb的外观:
config.omniauth :facebook, "API_KEY", "API_SECRET"
{:strategy_class => OmniAuth::Strategies::Facebook,
:scope => 'email, offline_access', :client_options => {:ssl => {:ca_file => '/usr/lib/ssl/certs/ca-certificates.crt'}}}
这是我的omniauth\u callbacks\u controller.rb:
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
def facebook
# You need to implement the method below in your model (e.g. app/models/user.rb)
@user = User.find_for_facebook_oauth(request.env["omniauth.auth"], current_user)
if @user.persisted?
sign_in_and_redirect @user, :event => :authentication #this will throw if @user is not activated
set_flash_message(:notice, :success, :kind => "Facebook") if is_navigational_format?
else
session["devise.facebook_data"] = request.env["omniauth.auth"]
redirect_to new_user_registration_url
end
end
end
谢谢你的帮助 因此,如果我是对的(不是100%安全),您需要声明您的模型具有可确认的模块,添加可确认的模块:
devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :omniauthable, :confirmable
并确保用户表上有可确认模块的字段,您应该在
如果您没有这些字段,请检查如何添加它们 用户是否有可确认模块?class User
devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :omniauthable, :confirmable