Bird
0
0

You want to ensure your Ruby project always uses the exact same gem versions on any machine. Which Bundler feature should you use?

hard📝 Application Q15 of 15
Ruby - Gems and Bundler
You want to ensure your Ruby project always uses the exact same gem versions on any machine. Which Bundler feature should you use?
Abundle update to refresh gems
Bgem uninstall to remove old gems
CGemfile.lock to lock gem versions
Dbundle exec to run commands
Step-by-Step Solution
Solution:
  1. Step 1: Understand version consistency needs

    To keep gem versions consistent across machines, Bundler uses a lock file that records exact versions installed.
  2. Step 2: Identify the correct Bundler feature

    The Gemfile.lock file stores the exact gem versions after running bundle install.
  3. Step 3: Differentiate other options

    bundle update refreshes gems, gem uninstall removes gems, and bundle exec runs commands in context but doesn't lock versions.
  4. Final Answer:

    Gemfile.lock to lock gem versions -> Option C
  5. Quick Check:

    Gemfile.lock locks versions for consistency [OK]
Quick Trick: Use Gemfile.lock to freeze gem versions across machines [OK]
Common Mistakes:
  • Confusing bundle update with locking versions
  • Thinking bundle exec locks gem versions
  • Ignoring Gemfile.lock file importance

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes