Skip to content

Conversation

@moberegger
Copy link
Contributor

Simply adds #frozen_string_literal: true to all files. No idea why these were missing. Don't think this will make a huge difference, but it can't hurt.

Are these necessary/useful for Rakefile, Gemfile, etc? This PR includes them, but not 100% sure if that's correct.

We can also consider configuring action_view.frozen_string_literal = true in the railtie. Something like

config.before_configuration do |app|
  # Makes is so that string literals are frozen and interned in our jbuilder templates to save
  # on memory allocations.
  app.config.action_view.frozen_string_literal = true
end

Not sure if this is something that jbuilder should force, but I think this is something you will generally want. Wouldn't surprise me if there are users of the gem that are unaware that strings in their templates aren't being interned.

@moberegger moberegger closed this Jun 13, 2025
@moberegger moberegger deleted the moberegger/add-frozen-string-literal branch June 13, 2025 18:54
@moberegger moberegger restored the moberegger/add-frozen-string-literal branch June 17, 2025 02:04
@moberegger moberegger reopened this Jun 17, 2025
@rafaelfranca rafaelfranca merged commit 324421b into rails:main Jul 18, 2025
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants