views:

1114

answers:

3

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 '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.

A: 
gem "rack-openid", :require => "rack/openid"
Simone Carletti
I tried it, but there is the same error as with `gem "rack-openid", :require => "rack-openid"`
But did you installed rack-openid or ruby-openid? I updated my answer according to `rack-openid`
Simone Carletti
Yes, i did: rack-openid, ruby-openid is installed gems.
+1  A: 

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!

Fabiano PS
Yes it works as Fabiano PS says! Please follow this setup. If not you won't be able to run rake open_id_authentication:db:create!! Thanks a ton Fabiano. Solved my problem.
Shripad K
+3  A: 

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.

epochwolf