Ruby on Rails:奇怪的样式表问题
当我打开一个使用 CSS 的页面时,它会工作一次,但在打开 CSS 并重新保存之前不会再次工作。每次我尝试直接访问我的 CSS 时,它都工作正常。但其他时候,它不起作用,我收到以下服务器输出:
[2010-08-01 12:49:37] ERROR NoMethodError: private method `gsub!' called for #<Class:0x7f6d0639ad80>
/usr/lib/ruby/1.8/webrick/htmlutils.rb:16:in `escape'
/usr/lib/ruby/1.8/webrick/httpresponse.rb:232:in `set_error'
/var/www/rails-blog/vendor/rails/railties/lib/webrick_server.rb:94:in `handle_file'
/var/www/rails-blog/vendor/rails/railties/lib/webrick_server.rb:73:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
/var/www/rails-blog/vendor/rails/railties/lib/webrick_server.rb:60:in `dispatch'
/var/www/rails-blog/vendor/rails/railties/lib/commands/servers/webrick.rb:66
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
/var/www/rails-blog/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in `require'
/var/www/rails-blog/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
/var/www/rails-blog/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in `require'
/var/www/rails-blog/vendor/rails/railties/lib/commands/server.rb:49
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
script/server:3
127.0.0.1 - - [01/Aug/2010:12:49:37 BST] "GET /stylesheets/scaffold.css HTTP/1.1" 500 343
- -> /stylesheets/scaffold.css?1280662371
我用来包含样式表的代码是 <%= stylesheet_link_tag 'scaffold' %>
。我已经重新启动了 Ruby 服务器,但没有效果。什么可能导致这个问题?
这是阅读官方指南之一。
运行 Mongrel 时不会发生这种情况。
When I open up a page that's using my CSS it will work once, but won't work again until you open up the CSS and re-save it. Every other time I try to directly access my CSS, it works fine. But the other times, it doesn't work and I receive this server output:
[2010-08-01 12:49:37] ERROR NoMethodError: private method `gsub!' called for #<Class:0x7f6d0639ad80>
/usr/lib/ruby/1.8/webrick/htmlutils.rb:16:in `escape'
/usr/lib/ruby/1.8/webrick/httpresponse.rb:232:in `set_error'
/var/www/rails-blog/vendor/rails/railties/lib/webrick_server.rb:94:in `handle_file'
/var/www/rails-blog/vendor/rails/railties/lib/webrick_server.rb:73:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
/var/www/rails-blog/vendor/rails/railties/lib/webrick_server.rb:60:in `dispatch'
/var/www/rails-blog/vendor/rails/railties/lib/commands/servers/webrick.rb:66
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
/var/www/rails-blog/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in `require'
/var/www/rails-blog/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
/var/www/rails-blog/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in `require'
/var/www/rails-blog/vendor/rails/railties/lib/commands/server.rb:49
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
script/server:3
127.0.0.1 - - [01/Aug/2010:12:49:37 BST] "GET /stylesheets/scaffold.css HTTP/1.1" 500 343
- -> /stylesheets/scaffold.css?1280662371
The code I'm using to include the stylesheet is <%= stylesheet_link_tag 'scaffold' %>
. I've restarted the Ruby server but with no effect. What could be causing this problem?
This is from reading one of the official guides.
This does not happen when running Mongrel.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是 WEBrick 中的一个错误,请参阅 http://www.ruby-forum.com/topic/ 206225。
2010 年 6 月 10 日 03:19,Michael Pitman (mcp) 发布了:
This is a bug in WEBrick, see http://www.ruby-forum.com/topic/206225.
On 10.06.2010 03:19, Michael Pitman (mcp) posted: