未定义的方法“omniauth”对于 Devise:模块(devise、omniauth、heroku、rails 3.0.3)
我有一个在本地使用亚马逊产品广告 API 的应用程序,没有任何问题。为了将其推送到 Heroku,我必须更改我使用的 aws gem 的版本,以使其与 Heroku 一起使用(“treyconnell-ruby-aaws”v0.8.3),并且该版本将我限制为 Rails 3.0.3 和设计 v1.1.8 宝石。
当我降级宝石和“捆绑更新”时,本地出现了一些情况,猜测omniauth和devise开始战斗。服务器无法启动并出现以下错误日志。
我尝试了加载omniauth gem、oa-auth、需要omniauth/oauth等的许多不同配置,仍然是相同的错误。这里可能有什么问题?
附言。我现在必须使用这个 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 文件:
# 使用此钩子来配置 devise mailer、warden 钩子等。第一个 # 四个配置值也可以直接在您的模型中设置。 Devise.setup 执行 |config| config.mailer_sender = "[电子邮件受保护]" 需要 'devise/orm/active_record' config.omniauth :facebook,“1****************”,“3**************************** *****” config.case_insensitive_keys = [ :email ] 配置.拉伸 = 10 config.use_salt_as_remember_token = true config.reset_password_within = 2.小时 结尾
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为 devise.rb 中的 config.facebook 行让您感到悲伤。
我查看了我的
devise.rb
,还有另一个名为omniauth.rb
的文件。(1) 我的 devise.rb 没有 config.facebook 行。尝试删除它,看看它是否有效。
(2) 我有一个名为
omniauth.rb
的文件,与devise.rb
位于同一目录中。我将其粘贴在下面:看看这是否适合您。 :)
I think the
config.facebook
line indevise.rb
is causing you the grief.I took a look at my
devise.rb
and I also have another file calledomniauth.rb
.(1) My
devise.rb
does not have theconfig.facebook
line. Try removing that and see if it works.(2) I have a file called
omniauth.rb
, located in the same directory asdevise.rb
. I'm pasting it below:See if this works out for you. :)