使用facebook登录集成键的spree_social gem的初始化程序

我有一个基于狂欢的应用程序,应该与Facebook集成。 我这样做是通过spree_social gem工作正常,但我需要一些配置文件,所以我不必每次点击管理面板。

我添加了ne初始化程序:

/config/initializers/devise.rb

require 'omniauth-facebook' Devise.setup do |config| config.omniauth :facebook, KEY, SECRET end 

但这没有任何作用。

我在网上尝试了所有可能的教程和示例,即https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview或http://sleekd.com/tutorials/setting-up-omniauth-authentication-with- Facebook的/

但没有任何作用,所以必须有一些我看不到的其他错误。

唯一有效的方法是:

 ActiveRecord::Base.connection.execute(SQL query here) 

它更新了db中的正确列,但这可能完全不是Ruby方式,它看起来很糟糕。

我在spree_social gem挖了,有这样的方法:

  def update_oauth_method auth_method = params[:authentication_method] if auth_method[:active] == "true" && auth_method[:environment] == ::Rails.env Devise.setup do |config| config.omniauth auth_method[:provider], auth_method[:api_key], auth_method[:api_secret] end end end 

但我找不到任何方法将它保存到数据库中。

不幸的是我无法在配置/初始化器中设置断点,所以我无法完成它,因为我必须盲目地测试配置。

您可以使用种子数据使用令牌填充数据库。

Interesting Posts