Ruby on Rails测试和控制台均退出,并出现cache_control错误

时间:2019-05-08 16:07:51

标签: ruby-on-rails

我很困惑。 rails testrails console突然停止为我的项目工作,并且我找不到为引起问题而进行的任何最近更改。运行任何一个都会引发此错误:

/var/lib/gems/2.3.0/gems/actionpack-5.1.7/lib/action_dispatch/http/response.rb:89:in `<class:Response>': undefined method `cache_control' for class `ActionDispatch::Response' (NameError)
    from /var/lib/gems/2.3.0/gems/actionpack-5.1.7/lib/action_dispatch/http/response.rb:35:in `<module:ActionDispatch>'
    from /var/lib/gems/2.3.0/gems/actionpack-5.1.7/lib/action_dispatch/http/response.rb:6:in `<top (required)>'
    from /var/lib/gems/2.3.0/gems/actionpack-5.1.7/lib/action_controller/metal/live.rb:1:in `require'
    from /var/lib/gems/2.3.0/gems/actionpack-5.1.7/lib/action_controller/metal/live.rb:1:in `<top (required)>'
    from /var/lib/gems/2.3.0/gems/actionpack-5.1.7/lib/action_controller.rb:4:in `require'
    from /var/lib/gems/2.3.0/gems/actionpack-5.1.7/lib/action_controller.rb:4:in `<top (required)>'
    from /var/lib/gems/2.3.0/gems/actionpack-5.1.7/lib/action_controller/railtie.rb:2:in `require'
    from /var/lib/gems/2.3.0/gems/actionpack-5.1.7/lib/action_controller/railtie.rb:2:in `<top (required)>'
    from /var/lib/gems/2.3.0/gems/activerecord-5.1.7/lib/active_record/railtie.rb:9:in `require'
    from /var/lib/gems/2.3.0/gems/activerecord-5.1.7/lib/active_record/railtie.rb:9:in `<top (required)>'
    from /var/lib/gems/2.3.0/gems/railties-5.1.7/lib/rails/all.rb:14:in `require'
    from /var/lib/gems/2.3.0/gems/railties-5.1.7/lib/rails/all.rb:14:in `block in <top (required)>'
    from /var/lib/gems/2.3.0/gems/railties-5.1.7/lib/rails/all.rb:12:in `each'
    from /var/lib/gems/2.3.0/gems/railties-5.1.7/lib/rails/all.rb:12:in `<top (required)>'
    from /home/jeff/src/rails/sfpix/config/application.rb:3:in `require'
    from /home/jeff/src/rails/sfpix/config/application.rb:3:in `<top (required)>'
    from /var/lib/gems/2.3.0/gems/spring-2.0.2/lib/spring/application.rb:92:in `require'
    from /var/lib/gems/2.3.0/gems/spring-2.0.2/lib/spring/application.rb:92:in `preload'
    from /var/lib/gems/2.3.0/gems/spring-2.0.2/lib/spring/application.rb:153:in `serve'
    from /var/lib/gems/2.3.0/gems/spring-2.0.2/lib/spring/application.rb:141:in `block in run'
    from /var/lib/gems/2.3.0/gems/spring-2.0.2/lib/spring/application.rb:135:in `loop'
    from /var/lib/gems/2.3.0/gems/spring-2.0.2/lib/spring/application.rb:135:in `run'
    from /var/lib/gems/2.3.0/gems/spring-2.0.2/lib/spring/application/boot.rb:19:in `<top (required)>'
    from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from -e:1:in `<main>'

Google搜索没有产生任何有用的建议。我尝试过检查较早的工作提交,并运行bundle install来使用其Gemfile.lock文件将gem降级,但是我仍然收到相同的错误消息。

如果我将其添加到其他Rails项目中,则rails testrails console可以正常工作。

有人对从哪里开始寻找东西有任何想法吗?

非常感谢,
杰夫

1 个答案:

答案 0 :(得分:0)

Github上的某人建议我至少升级到Rack 2.0。那立即解决了我的问题。