Skip to content

Commit 2601415

Browse files
authored
Merge pull request rails#51692 from Shopify/require-debug-prelude-in-gemfile-template
Add `require: "debug/prelude"` after `debug`'s Gemfile entry
2 parents 6a38d3a + 7254549 commit 2601415

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

railties/CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
* Generated Gemfile will include `require: "debug/prelude"` for the `debug` gem
2+
3+
Requiring `debug` gem directly automatically activates it, which could introduce
4+
additional overhead and memory usage even without entering a debugging session.
5+
6+
By making Bundler require `debug/prelude` instead, developers can keep their access
7+
to breakpoint methods like `debugger` or `binding.break`, but the debugger won't be
8+
activated until a breakpoint is hit.
9+
10+
*Stan Lo*
11+
112
* Allow Actionable Errors encountered when running tests to be retried.
213

314
```txt

railties/lib/rails/generators/rails/app/templates/Gemfile.tt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ gem "bootsnap", require: false
3333

3434
group :development, :test do
3535
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
36-
gem "debug", platforms: %i[ mri <%= bundler_windows_platforms %> ]
36+
gem "debug", platforms: %i[ mri <%= bundler_windows_platforms %> ], require: "debug/prelude"
3737
<%- unless options.skip_brakeman? -%>
3838

3939
# Static analysis for security vulnerabilities [https://brakemanscanner.org/]

0 commit comments

Comments
 (0)