ruby-on-rails – Rails 4.2.0.beta2中的奇怪行为 – 这是一个错误吗?

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – Rails 4.2.0.beta2中的奇怪行为 – 这是一个错误吗?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
每次重新加载窗口时都会收到500错误.

资产/应用程序 – 找不到CACHE-.js.不知道造成它的原因.发展环境.使用Unicorn作为我的网络服务器.有谁知道这是什么吗?

17:07:13 web.1  | 127.0.0.1 - - [15/Oct/2014:17:07:13 -0400] "GET /blog HTTP/1.1" 200 - 0.2885
17:07:13 web.1  | 127.0.0.1 - - [15/Oct/2014:17:07:13 -0400] "GET /about-64845c436e75ac587deec98177291d4e.css?body=1 HTTP/1.1" 304 - 0.0110
17:07:13 web.1  | 127.0.0.1 - - [15/Oct/2014:17:07:13 -0400] "GET /blog-14053fca722628f43031ae06cb18c52c.css?body=1 HTTP/1.1" 304 - 0.0110
17:07:13 web.1  | 127.0.0.1 - - [15/Oct/2014:17:07:13 -0400] "GET /contact-64845c436e75ac587deec98177291d4e.css?body=1 HTTP/1.1" 304 - 0.0112
17:07:13 web.1  | 127.0.0.1 - - [15/Oct/2014:17:07:13 -0400] "GET /layouts/partials/footer-71929e4ed77e723296d6a937e6469653.css?body=1 HTTP/1.1" 304 - 0.0116
17:07:13 web.1  | 127.0.0.1 - - [15/Oct/2014:17:07:13 -0400] "GET /portfolio-64845c436e75ac587deec98177291d4e.css?body=1 HTTP/1.1" 304 - 0.0133
17:07:13 web.1  | 127.0.0.1 - - [15/Oct/2014:17:07:13 -0400] "GET /layouts/partials/navigation-1d28f98b6c63feaf0bd6b06fb5873475.css?body=1 HTTP/1.1" 304 - 0.0136
17:07:13 web.1  | 127.0.0.1 - - [15/Oct/2014:17:07:13 -0400] "GET /resources-64845c436e75ac587deec98177291d4e.css?body=1 HTTP/1.1" 304 - 0.0130
17:07:13 web.1  | Rack::Lint::LintError: Content-Type header found in 304 response,not allowed
17:07:13 web.1  |   /Users/fab/.rvm/gems/ruby-2.1.0/gems/rack-1.6.0.beta/lib/rack/lint.rb:20:in `assert'
17:07:13 web.1  |   /Users/fab/.rvm/gems/ruby-2.1.0/gems/rack-1.6.0.beta/lib/rack/lint.rb:651:in `block in check_content_type'
17:07:13 web.1  |   /Users/fab/.rvm/gems/ruby-2.1.0/gems/rack-1.6.0.beta/lib/rack/lint.rb:647:in `each'
17:07:13 web.1  |   /Users/fab/.rvm/gems/ruby-2.1.0/gems/rack-1.6.0.beta/lib/rack/lint.rb:647:in `check_content_type'
17:07:13 web.1  |   /Users/fab/.rvm/gems/ruby-2.1.0/gems/rack-1.6.0.beta/lib/rack/lint.rb:58:in `_call'
17:07:13 web.1  |   /Users/fab/.rvm/gems/ruby-2.1.0/gems/rack-1.6.0.beta/lib/rack/lint.rb:37:in `call'
17:07:13 web.1  |   /Users/fab/.rvm/gems/ruby-2.1.0/gems/rack-1.6.0.beta/lib/rack/showexceptions.rb:24:in `call'
17:07:13 web.1  |   /Users/fab/.rvm/gems/ruby-2.1.0/gems/rack-1.6.0.beta/lib/rack/commonlogger.rb:33:in `call'
17:07:13 web.1  |   /Users/fab/.rvm/gems/ruby-2.1.0/gems/rack-1.6.0.beta/lib/rack/chunked.rb:54:in `call'
17:07:13 web.1  |   /Users/fab/.rvm/gems/ruby-2.1.0/gems/rack-1.6.0.beta/lib/rack/content_length.rb:15:in `call'
17:07:13 web.1  |   /Users/fab/.rvm/gems/ruby-2.1.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:576:in `process_client'
17:07:13 web.1  |   /Users/fab/.rvm/gems/ruby-2.1.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:670:in `worker_loop'
17:07:13 web.1  |   /Users/fab/.rvm/gems/ruby-2.1.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:525:in `spawn_missing_workers'
17:07:13 web.1  |   /Users/fab/.rvm/gems/ruby-2.1.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:140:in `start'
17:07:13 web.1  |   /Users/fab/.rvm/gems/ruby-2.1.0/gems/unicorn-4.8.3/bin/unicorn:126:in `<top (required)>'
17:07:13 web.1  |   /Users/fab/.rvm/gems/ruby-2.1.0/bin/unicorn:23:in `load'
17:07:13 web.1  |   /Users/fab/.rvm/gems/ruby-2.1.0/bin/unicorn:23:in `<main>'
17:07:13 web.1  |   /Users/fab/.rvm/gems/ruby-2.1.0/bin/ruby_executable_hooks:15:in `eval'
17:07:13 web.1  |   /Users/fab/.rvm/gems/ruby-2.1.0/bin/ruby_executable_hooks:15:in `<main>'
17:07:13 web.1  | 127.0.0.1 - - [15/Oct/2014:17:07:13 -0400] "GET /resume-64845c436e75ac587deec98177291d4e.css?body=1 HTTP/1.1" 304 - 0.0139
17:07:13 web.1  | 127.0.0.1 - - [15/Oct/2014:17:07:13 -0400] "GET /welcome-64845c436e75ac587deec98177291d4e.css?body=1 HTTP/1.1" 304 - 0.0138
17:07:13 web.1  | 127.0.0.1 - - [15/Oct/2014:17:07:13 -0400] "GET /jquery-6a50177757f6c64493882fb7aae952c3.js?body=1 HTTP/1.1" 304 - 0.0148
17:07:13 web.1  | 127.0.0.1 - - [15/Oct/2014:17:07:13 -0400] "GET /bootstrap/affix-04c58ad484d0bdbdf9514b7d09505d25.js?body=1 HTTP/1.1" 304 - 0.0141
17:07:13 web.1  | 127.0.0.1 - - [15/Oct/2014:17:07:13 -0400] "GET %2Fassets%2Fapplication-2e47777fcdd4d7b3353ccfc1718b4f0c.css?body=1 HTTP/1.1" 500 68784 0.0266
17:07:13 web.1  | 127.0.0.1 - - [15/Oct/2014:17:07:13 -0400] "GET /bootstrap/button-c9d4d44342d7be7abeb23fb0edbe00b7.js?body=1 HTTP/1.1" 304 - 0.0219
17:07:13 web.1  | 127.0.0.1 - - [15/Oct/2014:17:07:13 -0400] "GET /bootstrap/carousel-b0f1e7b56803d98d500f5ccc15d550e3.js?body=1 HTTP/1.1" 304 - 0.0150
17:07:13 web.1  | 127.0.0.1 - - [15/Oct/2014:17:07:13 -0400] "GET /bootstrap/alert-8186e091f2fa7c9423e9cadae6ce4de4.js?body=1 HTTP/1.1" 304 - 0.0258
17:07:13 web.1  | 127.0.0.1 - - [15/Oct/2014:17:07:13 -0400] "GET /bootstrap/collapse-417aacb8b3257798b481ed397b421b7c.js?body=1 HTTP/1.1" 304 - 0.0158
17:07:13 web.1  | 127.0.0.1 - - [15/Oct/2014:17:07:13 -0400] "GET /bootstrap/tab-dec75af9b2fFeed03dc43eabdb771d48.js?body=1 HTTP/1.1" 304 - 0.0123
17:07:13 web.1  | 127.0.0.1 - - [15/Oct/2014:17:07:13 -0400] "GET /bootstrap/dropdown-f5a24e96d563b9a6d252c1c07a6ecc6b.js?body=1 HTTP/1.1" 304 - 0.0142
17:07:13 web.1  | 127.0.0.1 - - [15/Oct/2014:17:07:13 -0400] "GET /bootstrap/modal-82015eda5031618c5aba3ebf9fc2cf4b.js?body=1 HTTP/1.1" 304 - 0.0123
17:07:13 web.1  | 127.0.0.1 - - [15/Oct/2014:17:07:13 -0400] "GET /bootstrap/transition-3005c626234d995c29e4bcbd07b3ac0c.js?body=1 HTTP/1.1" 304 - 0.0138
17:07:13 web.1  | 127.0.0.1 - - [15/Oct/2014:17:07:13 -0400] "GET /bootstrap/scrollspy-f421d662af4612a610656bfeee3407d9.js?body=1 HTTP/1.1" 304 - 0.0140
17:07:13 web.1  | 127.0.0.1 - - [15/Oct/2014:17:07:13 -0400] "GET /bootstrap-sprockets-99470846ba99b7073a929a36d4cee32a.js?body=1 HTTP/1.1" 304 - 0.0139
17:07:13 web.1  | 127.0.0.1 - - [15/Oct/2014:17:07:13 -0400] "GET /bootstrap/tooltip-5e9e765caafcbcb1672a3e72ef7f4a3a.js?body=1 HTTP/1.1" 304 - 0.0158
17:07:13 web.1  | 127.0.0.1 - - [15/Oct/2014:17:07:13 -0400] "GET /bootstrap/popover-df8ed104d2525bbc4b4dad060e68cf99.js?body=1 HTTP/1.1" 304 - 0.0211
17:07:13 web.1  | 127.0.0.1 - - [15/Oct/2014:17:07:13 -0400] "GET /jquery_ujs-03cb26c4b41579fc5e95ea8f47ac5e18.js?body=1 HTTP/1.1" 304 - 0.0148
17:07:13 web.1  | 127.0.0.1 - - [15/Oct/2014:17:07:13 -0400] "GET /turbolinks-ebcce04d6463d2d77b51c18291df6925.js?body=1 HTTP/1.1" 304 - 0.0162
17:07:13 web.1  | 127.0.0.1 - - [15/Oct/2014:17:07:13 -0400] "GET /about-32740fa4bc301ff5ef2eca5d8d82335a.js?body=1 HTTP/1.1" 304 - 0.0140
17:07:13 web.1  | 127.0.0.1 - - [15/Oct/2014:17:07:13 -0400] "GET /blog-32740fa4bc301ff5ef2eca5d8d82335a.js?body=1 HTTP/1.1" 304 - 0.0145
17:07:13 web.1  | 127.0.0.1 - - [15/Oct/2014:17:07:13 -0400] "GET /contact-32740fa4bc301ff5ef2eca5d8d82335a.js?body=1 HTTP/1.1" 304 - 0.0164
17:07:13 web.1  | 127.0.0.1 - - [15/Oct/2014:17:07:13 -0400] "GET /portfolio-32740fa4bc301ff5ef2eca5d8d82335a.js?body=1 HTTP/1.1" 304 - 0.0178
17:07:13 web.1  | 127.0.0.1 - - [15/Oct/2014:17:07:13 -0400] "GET /resources-32740fa4bc301ff5ef2eca5d8d82335a.js?body=1 HTTP/1.1" 304 - 0.0131
17:07:13 web.1  | Rack::Lint::LintError: Content-Type header found in 304 response,not allowed
17:07:13 web.1  |   /Users/fab/.rvm/gems/ruby-2.1.0/gems/rack-1.6.0.beta/lib/rack/lint.rb:20:in `assert'
17:07:13 web.1  |   /Users/fab/.rvm/gems/ruby-2.1.0/gems/rack-1.6.0.beta/lib/rack/lint.rb:651:in `block in check_content_type'
17:07:13 web.1  |   /Users/fab/.rvm/gems/ruby-2.1.0/gems/rack-1.6.0.beta/lib/rack/lint.rb:647:in `each'
17:07:13 web.1  |   /Users/fab/.rvm/gems/ruby-2.1.0/gems/rack-1.6.0.beta/lib/rack/lint.rb:647:in `check_content_type'
17:07:13 web.1  |   /Users/fab/.rvm/gems/ruby-2.1.0/gems/rack-1.6.0.beta/lib/rack/lint.rb:58:in `_call'
17:07:13 web.1  |   /Users/fab/.rvm/gems/ruby-2.1.0/gems/rack-1.6.0.beta/lib/rack/lint.rb:37:in `call'
17:07:13 web.1  |   /Users/fab/.rvm/gems/ruby-2.1.0/gems/rack-1.6.0.beta/lib/rack/showexceptions.rb:24:in `call'
17:07:13 web.1  |   /Users/fab/.rvm/gems/ruby-2.1.0/gems/rack-1.6.0.beta/lib/rack/commonlogger.rb:33:in `call'
17:07:13 web.1  |   /Users/fab/.rvm/gems/ruby-2.1.0/gems/rack-1.6.0.beta/lib/rack/chunked.rb:54:in `call'
17:07:13 web.1  |   /Users/fab/.rvm/gems/ruby-2.1.0/gems/rack-1.6.0.beta/lib/rack/content_length.rb:15:in `call'
17:07:13 web.1  |   /Users/fab/.rvm/gems/ruby-2.1.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:576:in `process_client'
17:07:13 web.1  |   /Users/fab/.rvm/gems/ruby-2.1.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:670:in `worker_loop'
17:07:13 web.1  |   /Users/fab/.rvm/gems/ruby-2.1.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:525:in `spawn_missing_workers'
17:07:13 web.1  |   /Users/fab/.rvm/gems/ruby-2.1.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:140:in `start'
17:07:13 web.1  |   /Users/fab/.rvm/gems/ruby-2.1.0/gems/unicorn-4.8.3/bin/unicorn:126:in `<top (required)>'
17:07:13 web.1  |   /Users/fab/.rvm/gems/ruby-2.1.0/bin/unicorn:23:in `load'
17:07:13 web.1  |   /Users/fab/.rvm/gems/ruby-2.1.0/bin/unicorn:23:in `<main>'
17:07:13 web.1  |   /Users/fab/.rvm/gems/ruby-2.1.0/bin/ruby_executable_hooks:15:in `eval'
17:07:13 web.1  |   /Users/fab/.rvm/gems/ruby-2.1.0/bin/ruby_executable_hooks:15:in `<main>'
17:07:13 web.1  | 127.0.0.1 - - [15/Oct/2014:17:07:13 -0400] "GET /resume-32740fa4bc301ff5ef2eca5d8d82335a.js?body=1 HTTP/1.1" 304 - 0.0131
17:07:13 web.1  | 127.0.0.1 - - [15/Oct/2014:17:07:13 -0400] "GET /welcome-32740fa4bc301ff5ef2eca5d8d82335a.js?body=1 HTTP/1.1" 304 - 0.0147
17:07:13 web.1  | 127.0.0.1 - - [15/Oct/2014:17:07:13 -0400] "GET %2Fassets%2Fapplication-c17db73b14421ee3a4d7e97bd3a6041c.js?body=1 HTTP/1.1" 500 68757 0.0217

每个其他页面重新加载我得到500个未找到的内部错误资产:

GET http://localhost:5000/assets/application-ddb2488b062b582487dc9a71475f69b3.css?body=1 
GET http://localhost:5000/assets/application-89761eef2e06fafdfbe675623cff99d7.js?body=1

解决方法

是的,它似乎是一个错误(或不是?).资产预编译时:
RAILS_ENV=production bin/rake assets:precompile

在config / environments / development.rb中:

config.assets.digest = true

因为在Rails 4.2(Release Notes,Pull Request)中默认是正确的,你将在开发环境中得到这个错误,无论你使用什么服务器(我在WEBrick和Thin都得到它).据我所知,它试图从/ public / assets获得预编译资产,但由于失败而失败

Content-Type header found in 304 response,not allowed

或类似的东西.

每次开始开发时,都可以通过清理/ public / assets来避免这种行为:

bin/rake assets:clobber

或者在开发配置中关闭资产摘要

config.assets.digest = false

或者通过关闭在开发配置中提供的静态资产:

config.assets.digest = true
config.serve_static_assets = false

猜你在找的Ruby相关文章