更新时间:2022-10-17 12:59:59
如果底层文件系统区分大小写(它在linux上,这是heroku的基础),那么 require $ c>需要区分大小写。
更改为:require => 'gmail'
而不是 Gmail
,您应该可以。
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?
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 of Gmail
and you should be ok.