Trouble with bundler

Hi Folks,

I’m having trouble using the oauth gem in rails apps. I think this may
be me not understanding how to load it with Bundler, and I would love
any feedback to guide me donw the right path.

I’m using Ruby 1.9.2 and Rails 3.0.3. I did a gem install oauth; I
also tried a bundle install oauth, but no luck. If I include a line:

require ‘oauth’

in a controller, I get a LoadError: no such file to load – oauth.

In irb, I have no problem with oauth:

ruby-1.9.2-p136 :001 > require ‘rubygems’
=> true
ruby-1.9.2-p136 :002 > require ‘oauth’
=> true
ruby-1.9.2-p136 :003 > OAuth::Consumer
=> OAuth::Consumer

In the rails console, no luck:

ruby-1.9.2-p136 :001 > OAuth::Consumer
NameError: uninitialized constant OAuth
from (irb):1
from /Users/acataldo/mentors/oauth-plugin/ruby/1.9.1/gems/
railties-3.0.3/lib/rails/commands/console.rb:44:in start' from /Users/acataldo/mentors/oauth-plugin/ruby/1.9.1/gems/ railties-3.0.3/lib/rails/commands/console.rb:8:instart’
from /Users/acataldo/mentors/oauth-plugin/ruby/1.9.1/gems/
railties-3.0.3/lib/rails/commands.rb:23:in <top (required)>' from script/rails:6:inrequire’
from script/rails:6:in <main>' ruby-1.9.2-p136 :002 > require 'oauth' LoadError: no such file to load -- oauth from /Users/acataldo/mentors/oauth-plugin/ruby/1.9.1/gems/ activesupport-3.0.3/lib/active_support/dependencies.rb:239:inrequire’
from /Users/acataldo/mentors/oauth-plugin/ruby/1.9.1/gems/
activesupport-3.0.3/lib/active_support/dependencies.rb:239:in block in require' from /Users/acataldo/mentors/oauth-plugin/ruby/1.9.1/gems/ activesupport-3.0.3/lib/active_support/dependencies.rb:225:inblock
in load_dependency’
from /Users/acataldo/mentors/oauth-plugin/ruby/1.9.1/gems/
activesupport-3.0.3/lib/active_support/dependencies.rb:596:in
new_constants_in' from /Users/acataldo/mentors/oauth-plugin/ruby/1.9.1/gems/ activesupport-3.0.3/lib/active_support/dependencies.rb:225:inload_dependency’
from /Users/acataldo/mentors/oauth-plugin/ruby/1.9.1/gems/
activesupport-3.0.3/lib/active_support/dependencies.rb:239:in
require' from (irb):2 from /Users/acataldo/mentors/oauth-plugin/ruby/1.9.1/gems/ railties-3.0.3/lib/rails/commands/console.rb:44:instart’
from /Users/acataldo/mentors/oauth-plugin/ruby/1.9.1/gems/
railties-3.0.3/lib/rails/commands/console.rb:8:in start' from /Users/acataldo/mentors/oauth-plugin/ruby/1.9.1/gems/ railties-3.0.3/lib/rails/commands.rb:23:in<top (required)>’
from script/rails:6:in require' from script/rails:6:in

Any advice on how to get rails to notice oauth?

Thanks!
Adam C.

This was just me being dumb. The trick is to add

gem ‘oauth’, ‘0.4.4’

to my Gemfile and THEN run

bundle install oauth

Doing it in the other direction is a bundler no-no.

On 25 January 2011 17:22, Adam C. [email protected] wrote:

This was just me being dumb. The trick is to add

gem ‘oauth’, ‘0.4.4’

to my Gemfile and THEN run

bundle install oauth

Don’t you just want
bundle install
after putting it in Gemfile. Why the oath on the end?

Colin