I’m learning Ruby on Rails using this excellent tutorial, and I noticed that the author always specifies the Gem version number in the Gemfile (see here, here, and here). Is this something I should get in the habit of doing? If so, how do I know what version to specify?
Share
I suggest to not specify the gem version, until you have found an incompatibility with a specific gem.
Bundler will itself lock a specific versions of the gems. You just need to remember to use
bundle install --deploymenton the production machine(s), and make upgrades only on your development machine (or in another directory).It will be very important to have a good test coverage of your project. Without tests, you will not know when an upgrade breaks your application. I humbly suggest the following route:
rake test(just to be sure that everything works)bundle updaterake testIf the test passes, commit the change in
Gemfile.lock. If the test does not pass, and you want to lock a given gem, then specify the version in Gemfile.You may read about install –deployment and deploying in the bundler documentation.