R – uninitialized constant Twitter::OAuth – Overlooking a require somewhere


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?

Best Solution

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'