Rails 2.3.5和Omniauth之间的不兼容性 [英] Incompatability between Rails 2.3.5 and Omniauth

查看:77
本文介绍了Rails 2.3.5和Omniauth之间的不兼容性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Rails 2.3.5并想使用Omniauth,但是我不能让它们一起工作,因为Rails 2.3.5要求Rack 1.0.1和Omniauth(版本0.1.6)需要Rack 1.1

I use Rails 2.3.5 and want to use Omniauth however I can't get them to work together, as rails 2.3.5 requies Rack 1.0.1 and Omniauth (version 0.1.6) requires Rack 1.1

我在Heroku上进行部署,所以我不相信我可以侵入Rails并删除对Rack 1.0.1版的严格依赖.

I deploy on Heroku so I don't believe I can hack into Rails and remove the hard dependency on version 1.0.1 of Rack.

非常感谢任何帮助.

保罗

推荐答案

我们遇到了类似的问题.我们在Rails 2.3.4上,想要使用OmniAuth(0.2.6).不幸的是,到目前为止,我发现的唯一可能的解决方案是升级到运行在Rack 1.1(OmniAuth要求的最低要求)上的Rails 2.3.8或更高版本,然后像这样要求OmniAuth:

We had a similar issue. We were on Rails 2.3.4 and wanted to use OmniAuth (0.2.6). Unfortunately the only possible solution I've found so far is to upgrade to Rails 2.3.8 or later which runs on Rack 1.1 (the minimum required by OmniAuth) and then require OmniAuth like so:

# In config/environment.rb require 'omniauth' (or 'oa-<strategy_name>') before Rails::Initialize
require 'omniauth'
Rails::Initializer.run do |config|
  ...

# Add your own initializer for OmniAuth
# /config/initializers/omniauth.rb
ActionController::Dispatcher.middleware.use OmniAuth::Builder do
  # your strategy provider logic
end

主要是通过此线程/其中的链接修饰的: http://groups.google.com/group/omniauth/browse_thread/thread/676fa835428e9c83

This was mostly groomed from this thread / links in it: http://groups.google.com/group/omniauth/browse_thread/thread/676fa835428e9c83

不幸的是,我现在处于所有这一切的中间,所以我不能保证这会完全奏效,因为我正在使用自定义策略,并且尚未完全实现.希望它为您提供了一些起点,让您在不做任何其他事情的情况下仍可以继续深入研究.

Unfortunately I'm in the middle of all of this right now so I can't promise this works fully as I'm using a custom strategy and haven't quite made it all the way to the end yet. Hopefully it provides some starting points for you to dig deeper if you're still stuck on this if nothing else.

这篇关于Rails 2.3.5和Omniauth之间的不兼容性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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