gem requite: false
This means install the gem, but do not call require when you start Bundler. So you will need to manually call
require "whenever"
if you want to use the library.
If you were to do
gem "whenever", require: "whereever"
then bundler would download the gem named whenever, but would call
require "whereever"
This is often used if the name of library to require is different than the name of the gem.
Is this done for performance reasons? – Venkat D. May 7 '12 at 18:50
@VenkatD. sometimes you want to install certain gems but you don't want to load them in to every process. I have a particular rake task that I want to invoke periodically on Heroku through their schedular add-on. This particular rake task requires certain gems that the rest of the application doensn't need. So I :require => false these particular gems and explicitly require "thegem" from the rake task. This would then save memory in the main app processes and startup time etc. App performance, however, should not be affected even if you require these additional gems in every process.
参考链接
https://stackoverflow.com/questions/4800721/what-does-require-false-in-gemfile-mean
网友评论