开发者

Problem with require rack/openid in Rails 3 [native require work properly]

I install plugin open_id_authentication and have this error:

/usr/lib/ruby/gems/1.9.1/gems/activesupport-3.0.0.beta/lib/active_support/dependencies.rb:167:in `require': no such file to load -- rack/openid (LoadError)

when I try to start rails server Actually, rack-openid installed in my system and i can load it from irb:

irb(main):001:0> require 开发者_如何学C'rack/openid'
=> true

I tried to add hack to Gemfile as I did with ruby-openid, but it did't help:

gem "ruby-openid", :require => "openid"
gem "rack-openid", :require => "rack/openid"

I also have tried

gem "ruby-openid", :require => "rack/openid"

but:

/usr/lib/ruby/gems/1.9.1/gems/bundler-0.9.7/lib/bundler/runtime.rb:38:in `require': no such file to load -- rack/openid (LoadError)

In rails 2.3.5 app there isn't this problem and I can't understand why it happens in Rails 3.


The problem is this code at the top of the plugin's init.rb

if Rails.version < '3'
  config.gem 'rack-openid', :lib => 'rack/openid', :version => '>=0.2.1'
end

Bundler doesn't seem to pick up on the gem requirement so you are missing the rack-openid gem.

The solution is to add the following to your Gemfile in place of ruby-openid. (rack-openid depends on ruby-openid but gems is aware of this and will install it as needed)

gem 'rack-openid', '>=0.2.1', :require => 'rack/openid'

Don't forget to run bundle install after updating your Gemfile.


I understand your problem since ruby openID can be very erratic, for small reasons.. I have it installed at work, but can't get it right at home! I will give my working recipe:

I have the Plugins (ONLY)
authlogic_openid from: http://github.com/binarylogic/authlogic_openid
open-id from: http://github.com/senthilnambi/open-id

The Gems:
authlogic (2.1.3)
authlogic-oid (1.0.4)
openid (0.0.1)
rack (1.0.1)
rack-openid (1.0.1)
ruby-openid (2.1.7)

At environment (ONLY):
config.gem "authlogic"

GL!


gem "rack-openid", :require => "rack/openid"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜