Skip to content
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

Fix a RuntimeError: #479

Closed
wants to merge 4 commits into from
Closed

Fix a RuntimeError: #479

wants to merge 4 commits into from

Conversation

tumayun
Copy link

@tumayun tumayun commented Aug 5, 2016

Fix a RuntimeError:

RuntimeError: can't modify frozen String
/Users/tumayun/.rvm/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/apipie-rails-0.3.6/app/controllers/apipie/apipies_controller.rb:118:in `sub!'
/Users/tumayun/.rvm/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/apipie-rails-0.3.6/app/controllers/apipie/apipies_controller.rb:118:in `block in get_format'
/Users/tumayun/.rvm/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/apipie-rails-0.3.6/app/controllers/apipie/apipies_controller.rb:116:in `each'
/Users/tumayun/.rvm/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/apipie-rails-0.3.6/app/controllers/apipie/apipies_controller.rb:116:in `get_format'
/Users/tumayun/.rvm/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/apipie-rails-0.3.6/app/controllers/apipie/apipies_controller.rb:20:in `index'
/Users/tumayun/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.0/lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
/Users/tumayun/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.0/lib/abstract_controller/base.rb:188:in `process_action'
/Users/tumayun/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.0/lib/action_controller/metal/rendering.rb:30:in `process_action'
/Users/tumayun/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.0/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
/Users/tumayun/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0/lib/active_support/callbacks.rb:126:in `call'
/Users/tumayun/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0/lib/active_support/callbacks.rb:506:in `block (2 levels) in compile'
/Users/tumayun/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0/lib/active_support/callbacks.rb:455:in `call'
/Users/tumayun/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0/lib/active_support/callbacks.rb:448:in `block (2 levels) in around'
/Users/tumayun/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0/lib/active_support/callbacks.rb:286:in `block (2 levels) in halting'
/Users/tumayun/.rvm/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/apipie-rails-0.3.6/app/controllers/apipie/apipies_controller.rb:163:in `set_script_name'
/Users/tumayun/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0/lib/active_support/callbacks.rb:382:in `block in make_lambda'
/Users/tumayun/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0/lib/active_support/callbacks.rb:285:in `block in halting'
/Users/tumayun/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0/lib/active_support/callbacks.rb:447:in `block in around'
/Users/tumayun/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0/lib/active_support/callbacks.rb:455:in `call'
/Users/tumayun/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0/lib/active_support/callbacks.rb:101:in `__run_callbacks__'
/Users/tumayun/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0/lib/active_support/callbacks.rb:750:in `_run_process_action_callbacks'
/Users/tumayun/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0/lib/active_support/callbacks.rb:90:in `run_callbacks'

tumayun added 3 commits August 6, 2016 00:06
RuntimeError: can't modify frozen String
/Users/tumayun/.rvm/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/apipie-ra
ils-0.3.6/app/controllers/apipie/apipies_controller.rb:118:in `sub!'
Because namespaced resource name may contain a "-" character
@mtparet mtparet mentioned this pull request Oct 17, 2016
@tumayun
Copy link
Author

tumayun commented Oct 27, 2016

Please merge this branch, thank you.

@iNecas
Copy link
Member

iNecas commented Oct 27, 2016

Hi, the rails 5 support is in progress, we just want first also to have a CI in place to be confident what gets in keeps working, see #495

@KapilMetacube
Copy link

KapilMetacube commented Nov 18, 2017

Hi, I'm encountering a similar issue, but of different type i.e. Array

An error occurred while loading ./spec/requests/users/registrations_spec.rb.
Failure/Error: require File.expand_path('../../config/environment', __FILE__)

RuntimeError:
  can't modify frozen Array
# C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/actionpack-5.0.6/lib/action_dispatch/middleware/stack.rb:96:in `push'
# C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/actionpack-5.0.6/lib/action_dispatch/middleware/stack.rb:96:in `use'
# C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/apipie-rails-0.5.5/lib/apipie/extractor.rb:18:in `block in <class:Railtie>'
# C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.0.6/lib/rails/initializable.rb:30:in `instance_exec'
# C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.0.6/lib/rails/initializable.rb:30:in `run'
# C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.0.6/lib/rails/initializable.rb:55:in `block in run_initializers'
# C:/Ruby24-x64/lib/ruby/2.4.0/tsort.rb:228:in `block in tsort_each'
# C:/Ruby24-x64/lib/ruby/2.4.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
# C:/Ruby24-x64/lib/ruby/2.4.0/tsort.rb:431:in `each_strongly_connected_component_from'
# C:/Ruby24-x64/lib/ruby/2.4.0/tsort.rb:349:in `block in each_strongly_connected_component'
# C:/Ruby24-x64/lib/ruby/2.4.0/tsort.rb:347:in `each'
# C:/Ruby24-x64/lib/ruby/2.4.0/tsort.rb:347:in `call'
# C:/Ruby24-x64/lib/ruby/2.4.0/tsort.rb:347:in `each_strongly_connected_component'
# C:/Ruby24-x64/lib/ruby/2.4.0/tsort.rb:226:in `tsort_each'
# C:/Ruby24-x64/lib/ruby/2.4.0/tsort.rb:205:in `tsort_each'
# C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.0.6/lib/rails/initializable.rb:54:in `run_initializers'
# C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.0.6/lib/rails/application.rb:352:in `initialize!'
# ./config/environment.rb:5:in `<top (required)>'
# C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/activesupport-5.0.6/lib/active_support/dependencies.rb:293:in `require'
# C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/activesupport-5.0.6/lib/active_support/dependencies.rb:293:in `block in require'
# C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/activesupport-5.0.6/lib/active_support/dependencies.rb:259:in `load_dependency'
# C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/activesupport-5.0.6/lib/active_support/dependencies.rb:293:in `require'
# ./spec/rails_helper.rb:20:in `<top (required)>'
# C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/activesupport-5.0.6/lib/active_support/dependencies.rb:293:in `require'
# C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/activesupport-5.0.6/lib/active_support/dependencies.rb:293:in `block in require'
# C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/activesupport-5.0.6/lib/active_support/dependencies.rb:259:in `load_dependency'
# C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/activesupport-5.0.6/lib/active_support/dependencies.rb:293:in `require'
# ./spec/swagger_helper.rb:1:in `<top (required)>'

Is it somehow related to this PR, or need to create another issue?

@KapilSachdev
Copy link

KapilSachdev commented Nov 21, 2017

@iNecas any updates?

Middleware.new(get_class(klass), args, block) (from action_dispatch/middleware/stack.rb) is not able to initailize the Apipie::Extractor::Recorder::Middleware and raising the error

RuntimeError:
  can't modify frozen Array
# C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/actionpack-5.0.6/lib/action_dispatch/middleware/stack.rb:96:in `push'
# C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/actionpack-5.0.6/lib/action_dispatch/middleware/stack.rb:96:in `use'
# C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/apipie-rails-0.5.5/lib/apipie/extractor.rb:18:in `block in <class:Railtie>'

Please help!

@KapilMetacube
Copy link

Sorry, my bad.
The error was occurring while running rspec and I had written require 'rails_helper' in two places and this was re-initializing the app and hence the error.

@ofedoren ofedoren force-pushed the master branch 2 times, most recently from 69442b9 to 8215e30 Compare July 25, 2021 19:41
@mathieujobin
Copy link
Collaborator

this was resolved a long time ago...

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.

5 participants