Flag to not leave so many comments in the default Gemfile

I make a lot of new Rails apps as I do a lot of tutorials and training and demo apps. I know that rails new has a bunch of flags to turn off gems and features, but what I want is a flag to leave the gems & features as-is but exclude all of the (slightly annoying) comments from the Gemfile.

What’s most annoying is clicking into each comment, interspersed between the gem lines, and deleting them over and over again for each new app. And frankly, they read like jr-developer comments that you wouldn’t normally put in a codebase.

“Use SCSS” proceeds the line gem 'sass-rails', '>= 6' … duh

at least the webpacker comment has a link to find more information. And then the rest of the comments read like sales information… like the Rails team is trying to sell me these Gems! Gems for sale! Turbolinks makes your application faster! Gems for sale! Build JSON APIs with ease! Gems for sale!

Like, Rails has been around a long time. the default gems are opinionated. everyone knows they can remove the defaults. Fine.

I’m just like every time I do rails new… the first thing I do is click line-by-line to remove these annoying comments. that’s my WTF rails.

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.6.4'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 6.0.3'
# Use sqlite3 as the database for Active Record
gem 'sqlite3', '~> 1.4'
# Use Puma as the app server
gem 'puma', '~> 4.1'
# Use SCSS for stylesheets
gem 'sass-rails', '>= 6'
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
gem 'webpacker', '~> 4.0'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.7'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use Active Model has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Active Storage variant
# gem 'image_processing', '~> 1.2'

# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.2', require: false

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]

group :development do
  # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '~> 3.2'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'

group :test do
  # Adds support for Capybara system testing and selenium driver
  gem 'capybara', '>= 2.15'
  gem 'selenium-webdriver'
  # Easy installation and use of web drivers to run system tests with browsers
  gem 'webdrivers'

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

I think that a --comment-light option for the Rails generators is a really interesting idea, and might well be worth implementing (especially as part of the more customizable generator experience being discussed in Interactive “rails new”.

However, I would appreciate you bringing a bit less snark to your discussion of why you find them annoying, and a bit more empathy for why other people might find them useful. One of the ground rules of this forum is that Rails is a big tent and we respect that other people use the framework differently than we do.

Personally, I’ve been developing Rails for twelve years. And it’s because of that that I find the comments helpful – Rails has evolved so much over the years, and I’ve definitely used the comments to help orient myself about new Rails features. I also find the comments helpful for educating new-to-Rails developers about which affordances are easy.


I find the comments absolutely helpful. I think they are great at documenting what the sometimes cryptic gem names add to a project, for both coworkers and future me. To the point where I ensure they all get a comment.

Spinning up a new Rails app isn’t something I do often. Those comments are absolutely helpful when I do.

1 Like

From my side, I’ve never really appreciated the comments in the Gemfile either. I’ve always found the Gemfile to be messy, and a bit annoying to get “looking clean”. It’s often been a matter of putting off removing some empty lines/comments not to pollute the diff.

I think the spirit of how this is done at the moment is to be at the same time some structured code (or data), and a document for humans to understand.

It’s related to another grip I have about Gemfiles is that there is no obvious way to group gems together or to order them so it doesn’t become unwieldy in the future. It often becomes a big jumbled mess of gems.

I’m afraid I don’t have any more solution paths than that, these are just my two cents.

(by the way, thanks @Betsy_Haibel for taking the time to help people with tone, it’s a job that requires a whole lot of effort and goodwill. I also know from the part of posters that it’s not always easy to strike the right tone, especially when dealing with frustration etc.)

1 Like

I’ve come a full 180 on this over the years - I used to remove all comments from my Gemfile and just alpha sort to have some kind of method.

And now I’m most of the way back to more or less arbitrary sorting but a comment on each gem justifying its existence (and in case of specific version restrictions, the issue or whatever that requires that). I do ping pong between several long lived codebases so that might have something to do with it.


all I’m suggesting is a simple flag to tell rails new to leave them out. I didn’t mean to be passing value judgement on anyone else’s way of doing Rails (or, especially, comments). Sorry if I came off that way.

@Betsy_Haibel-- I appreciate very much your feedback and I appreciate that Rail is a “Big tent” and that we should respect other’s ways of doing Rails, comments, and communicating.

I would appreciate not being tone-policed, as I wasn’t speaking to you in the first place, and your value-judgement of my tone as “too snarky” is not welcomed in this forum. I am offended by your statement and feel that you have no place in passing this judgement on me.

Just as I have no place in passing judgement on other people’s use of comments, you have no place in passing judgement on my “snark.”

If I offended you or anyone else I apologize, this was not my intention. My intention was merely to make humor and levity, and I will continue to create humor and levity on the internet because this is who I am and this is what I’m about. If you don’t like it, I invite you to move on.

Thanks for understand.

Respectfully, Jason

I think it was a mature and well measured response and I’d love to see more of it.


As Betsy already told you, she was asked to moderate the A May of WTFs discussions, so it is explicitly her “place” to tell you when your comments are too snarky, unwelcoming, and/or generally not appropriate.

I agree with her assessment here. We can have a discussion about cleaning up the default Gemfile, clarifying the comments, or optionally eliding them, but that’s going to require a mutual understanding that the comments were added in the first place to improve the onboarding experience for newbies. Things that seem perfectly obvious to you are not obvious to those new to Rails, who we wish to encourage.

I’m going to close this thread because it’s not constructive.