views:

653

answers:

2

I'm looking to use the latest Twitter gem for a Rails app I'm working on.

However, executing the following line:

oauth = Twitter::OAuth.new(ServiceAPIKeys.twitter['api_key'], ServiceAPIKeys.twitter['secret_key'])

Triggers the following exception:

uninitialized constant Twitter::OAuth

I do have the gem configured in my environment.rb using 'config.gem 'twitter'' and I have the gem unpacked into my vendor/gems directory. I've also tried tossing a 'require 'twitter'' inside the controller where I'm calling it.

Am I missing something obvious or is this an issue with the current gem?

+1  A: 

Problem found. There was another included gem, 'Twitter4r' that was using the Twitter namespace and it was taking precedence over the Twitter gem.

mwilliams
+1  A: 

What worked for me (Twitter4r is not installed on my system) is inserting "gem 'twitter'" like in:

require 'rubygems'
gem 'twitter'    <<--- INSERT THIS
require 'twitter'
Alain Ravet