独角兽和omniauth-facebook - 未初始化的常数OmniAuth [英] Unicorn and omniauth-facebook - uninitialized constant OmniAuth

查看:128
本文介绍了独角兽和omniauth-facebook - 未初始化的常数OmniAuth的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我试图让omniauth-facebook在我的生产环境中工作。在我的机器上使用POW,它在本地工作正常。

So I am trying to get omniauth-facebook to work in my production env. It works fine locally on my machine using POW.

我的prod env是ubuntu与nginx /独角兽,代码是Rails 3.2.13,来自独角兽的错误是: p>

My prod env is ubuntu with nginx/unicorn and code is Rails 3.2.13, the errors from unicorn are:

E, [2013-05-20T15:51:13.900829 #8737] ERROR -- : uninitialized constant OmniAuth (NameError)
/home/web/apps/****/releases/20130520041958/config/initializers/omniauth.rb:1:in `<top (required)>'

所以从我可以找到,我尝试在配置块上面添加我的production.rb文件中的 require'omniauth / facebook'现在我得到:

So from what I could find I try adding require 'omniauth/facebook' above the configure block to my production.rb file and now I get:

/home/web/apps/****/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require': cannot load such file -- omniauth/facebook (LoadError)

gemfile如下所示:

gemfile looks like this:

source 'https://rubygems.org'

gem 'rails', '3.2.13'
gem 'pg'
gem 'bcrypt-ruby', '3.0.1'
gem 'jquery-rails', '2.2.1'
gem 'omniauth-facebook'
gem 'simple_form'

初始化程序文件如下所示:

initializers file looks like this:

OmniAuth.config.logger = Rails.logger

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :facebook, ENV['FACEBOOK_APP_ID'], ENV['FACEBOOK_SECRET']
end

我在这里错过我遵循轨道转360,正如我在POW中所说的工作。

any ideas anyone? Am I missing here. I followed rails cast 360 and as I said works locally in POW.

推荐答案

嗨所有的想法,

首先我需要:

require 'omniauth-facebook'

require 'omniauth/facebook'

,重新启动独角兽停止,然后启动命令不是重启命令。

in the initializers file and when restarting unicorn do a stop, then start command not a restart command.

这篇关于独角兽和omniauth-facebook - 未初始化的常数OmniAuth的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆