Improve compatibility with frozen string literal #549
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When
ActionView::Template.frozen_string_literal
is set to true (e.g. viaRails.config.action_view.frozen_string_literal
), we get errors while rendering exception_notifier templates inside PP.pp on Ruby 3.3.6:The emails still come through, but the
session
component is replaced with this exception instead. I've seen other libraries avoid this for strings that need to be mutable by replacing""
with+""
, to ensure it's a copy of the literal and therefore mutable.I'm not entirely sure this entirely solves the problem - I wasn't able to properly run the exception_notification tests locally - but it should help out! In my application, this fixes the
session
section, but I haven't testeddata
thoroughly.I understand Ruby 3.4 will make this configuration the default, so this may become more pressing shortly!