Bird
0
0

You want to add a gem only for the development environment in your Gemfile. Which is the correct way to do this?

hard📝 Application Q15 of 15
Ruby - Gems and Bundler
You want to add a gem only for the development environment in your Gemfile. Which is the correct way to do this?
Agem 'pry', environment: 'development'
Bgroup :development do gem 'pry' end
Cgem 'pry' if ENV['RACK_ENV'] == 'development'
Dgroup 'development' gem 'pry' end
Step-by-Step Solution
Solution:
  1. Step 1: Recall how to specify environment groups in Gemfile

    Use group :environment_name do ... end block to add gems for specific environments.
  2. Step 2: Evaluate each option

    group :development do gem 'pry' end correctly uses group :development do ... end syntax. Others are invalid Ruby or Gemfile syntax.
  3. Final Answer:

    group :development do gem 'pry' end -> Option B
  4. Quick Check:

    Use group blocks for environment-specific gems [OK]
Quick Trick: Use group :env do ... end for environment gems [OK]
Common Mistakes:
  • Trying to add environment as gem option
  • Using if conditions inside Gemfile
  • Incorrect group block syntax

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes