patternrubyCritical
Ruby: What does 'require: false' in Gemfile mean?
Viewed 0 times
rubydoesmeanrequiregemfilefalsewhat
Problem
Does this:
mean that the gem needs to be installed, or does it mean it is not required?
gem 'whenever', require: falsemean that the gem needs to be installed, or does it mean it is not required?
Solution
This means install the gem, but do not call require when you start Bundler. So you will need to manually call
if you want to use the library.
If you were to do
then bundler would download the gem named whenever, but would call
This is often used if the name of library to require is different than the name of the gem.
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.
Code Snippets
require "whenever"gem "whenever", require: "whereever"require "whereever"Context
Stack Overflow Q#4800721, score: 531
Revisions (0)
No revisions yet.