New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruby 2.3 frozen string literals in controllers result in a RuntimeError #2036

Closed
fnordfish opened this Issue May 11, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@fnordfish
Contributor

fnordfish commented May 11, 2016

Activating frozen string literals in ruby 2.3 and using String routes result in a RuntimeError.

Sample Code:

# frozen_string_literal: true
MyApp.controllers :stuff do
  get "/test" do
  end
end

Result:

RuntimeError - can't modify frozen String:
/home/vagrant/.gem/ruby/2.3.0/gems/padrino-core-0.13.2/lib/padrino-core/application/routing.rb:627:in `gsub!': can't modify frozen String (RuntimeError)

Possible workarounds:

  • disable frozen string literals: # frozen_string_literal: false (not sure if that is a future-proof solution)
  • explicitly "unfreeze" the route string: get "/test".dup do; end (looks a bit bulky)

@ujifgc ujifgc closed this in 131921f May 11, 2016

@ujifgc

This comment has been minimized.

Show comment
Hide comment
@ujifgc

ujifgc May 11, 2016

Member

Thank you for your report.

Member

ujifgc commented May 11, 2016

Thank you for your report.

ujifgc added a commit that referenced this issue Sep 8, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment