I'm using a gem for gmail in my Rails app. My Gemfile contains:
gem 'gmail-api-ruby', :require => 'Gmail'
And in my controller, I initialize the gem with (using devise/omniauth to get the refresh_token
from Google):
Gmail.client_id = ENV['CLIENT_ID']
Gmail.client_secret = ENV['CLIENT_SECRET']
Gmail.refresh_token = current_user.refresh_token
This works fine in development, but when I deploy to Heroku, I get the following error:
/app/vendor/bundle/ruby/2.2.0/gems/bundler-1.7.12/lib/bundler/runtime.rb:76:in `require': cannot load such file -- Gmail (LoadError)
I cannot figure out why. Should I be requiring the gem somewhere else in my app?
- Ruby 2.2.0
- Bundler: 1.8.5
- Rails: 4.2.0
Just remove useless
require
option from yourGemfile
becausebundler
can load classes inside of this gem without specifyrequire
option in your case.and run
bundle install
.FYI: read section about
require
option here.require
is case sensitive if the underlying filesystem is case sensitive (which it is on linux, which is what underpins heroku)Change to
:require => 'gmail'
instead ofGmail
and you should be ok.