我有一个在本地使用亚马逊产品广告API的应用程序,没有任何问题。为了将它推送到Heroku,我必须更改我用来使它与Heroku(“treyconnell-ruby-aaws”v0.8.3)一起使用的aws gem的版本,并且该版本限制我使用Rails 3.0.3并且设计v1.1.8宝石。
当我降级宝石和'捆绑更新'时,某些东西在本地突破,猜测omniauth并设计开始战斗。服务器无法启动以下错误日志。
我尝试了许多不同配置的加载omniauth gem,oa-auth,需要omniauth / oauth等,仍然是同样的错误。这可能是什么问题?
PS。我现在必须使用这个aws gem。
/Users/eerdogan/Sites/myApp/config/initializers/devise.rb:17: undefined method `omniauth' for Devise:Module (NoMethodError)
from /Library/Ruby/Gems/1.8/gems/devise-1.1.8/lib/devise.rb:183:in `setup'
from /Users/eerdogan/Sites/myApp/config/initializers/devise.rb:3
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:235:in `load'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:235:in `load'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `load_dependency'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:596:in `new_constants_in'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `load_dependency'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:235:in `load'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/engine.rb:201
from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/engine.rb:200:in `each'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/engine.rb:200
from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/initializable.rb:25:in `instance_exec'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/initializable.rb:25:in `run'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/initializable.rb:50:in `run_initializers'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/initializable.rb:49:in `each'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/initializable.rb:49:in `run_initializers'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/application.rb:134:in `initialize!'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/application.rb:77:in `send'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/application.rb:77:in `method_missing'
from /Users/eerdogan/Sites/myApp/config/environment.rb:5
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `load_dependency'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:596:in `new_constants_in'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `load_dependency'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
from /Users/eerdogan/Sites/myApp/config.ru:3
from /Library/Ruby/Gems/1.8/gems/rack-1.2.4/lib/rack/builder.rb:46:in `instance_eval'
from /Library/Ruby/Gems/1.8/gems/rack-1.2.4/lib/rack/builder.rb:46:in `initialize'
from /Users/eerdogan/Sites/myApp/config.ru:1:in `new'
from /Users/eerdogan/Sites/myApp/config.ru:1
编辑:这是devise.rb文件:
# Use this hook to configure devise mailer, warden hooks and so forth. The first # four configuration values can also be set straight in your models. Devise.setup do |config| config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com" require 'devise/orm/active_record' config.omniauth :facebook, "1*************", "3******************************" config.case_insensitive_keys = [ :email ] config.stretches = 10 config.use_salt_as_remember_token = true config.reset_password_within = 2.hours end
答案 0 :(得分:2)
我认为config.facebook
中的devise.rb
行会让您感到悲伤。
我查看了我的devise.rb
,还有另一个名为omniauth.rb
的文件。
(1)我的devise.rb
没有config.facebook
行。尝试删除它,看看它是否有效。
(2)我有一个名为omniauth.rb
的文件,与devise.rb
位于同一目录中。我在下面粘贴它:
require 'openid/store/filesystem'
Rails.application.config.middleware.use OmniAuth::Builder do
case Rails.env
when "development"
provider :facebook, 'XXX', 'XXXX' , {:scope => 'manage_pages,publish_stream,offline_access,email'}
when "production"
provider :facebook, 'XXX', 'XXXX', {:scope => 'manage_pages,publish_stream,offline_access,email', :client_options => {:ssl => {:ca_file => '/usr/lib/ssl/certs/ca-certificates.crt'}}}
end
end
看看这是否适合你。 :)