Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

281
Views
'# frozen_string_literal: true' is really needed in a rails application??? do i need to put it in each file?

Every file of my rails app i'm editing displays this warning, missing frozen string literal comment, i know this is used to reserve memory and avoid memory re-allocation for all strings literal, but is it necessary to use on rails or its enabled by default? if so, how to enable it globally?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Nope, it's not enabled by default.

However, you may use Rubocop to append it to the top of your files with Rubocop::Cop::Style::FrozenStringLiteralComment. It's an auto-correctable cop.

According to Holger Just:

You can actually enable it globally by invoking the ruby interpreter with ruby --enable=frozen-string-literal. However, this is usually a bad idea and will break in various subtle ways unless you are very sure that all files in all your gems and dependencies actually expect frozen literals (which is generally not the case)

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!