ruby-on-rails – Rails生产服务器:样式表不显示!

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – Rails生产服务器:样式表不显示!前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我刚从我的开发数据库切换到生产数据库,我意识到我正在得到一个一致的错误nomatter我试图打开什么样的视图.尽管在正确的位置,样式表未正确加载.

以下是有关错误的一些信息:

视图

@H_404_6@<head> <%= stylesheet_link_tag "global","home","http://static.flowplayer.org/tools/css/scrollable-navig.css" %> </head>

安慰

@H_404_6@Started GET "/stylesheets/global.css?1287048448" for 127.0.0.1 at 2010-10-15 00:18:43 -0400 Processing by WelcomeController#long_switchboard as CSS Parameters: {"1287048448"=>nil,"path"=>"stylesheets","link"=>"global"} Completed in 2ms NoMethodError (undefined method `id' for nil:NilClass): app/controllers/welcome_controller.rb:76:in `long_switchboard' Rendered C:/Sanj/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.0/lib/action_dispatch/middleware/templates/rescues/_trace.erb (2.0ms) Rendered C:/Sanj/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.0/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (7.0ms) Rendered C:/Sanj/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack3.0.0/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (108.0ms)

页面来源

@H_404_6@<link href="/stylesheets/global.css?1287048448" media="screen" rel="stylesheet" type="text/css" /> <link href="/stylesheets/home.css?1287086704" media="screen" rel="stylesheet" type="text/css" /> <link href="http://static.flowplayer.org/tools/css/scrollable-navig.css" media="screen" rel="stylesheet" type="text/css" />

当我尝试从页面源打开“全局”和“家”样式表时,它们不会打开.我尝试添加“public /”到URL,但它表示没有路由匹配.

位置

所有非http样式表都以root / public / stylesheets /

路线

最后两条路线是“全能”,只有网站上的特定功能.这些似乎正在捕捉我的样式表(也可能是其他标签).

@H_404_6@match ':path/:link' => 'welcome#long_switchboard' match ':path' => 'welcome#short_switchboard'

解决方法

thread有一些建议…

根据您的网络服务器,您可能需要更改config / environments / prodcution.rb中的以下设置:

@H_404_6@config.serve_static_assets = false

至:

@H_404_6@config.serve_static_assets = true
原文链接:https://www.f2er.com/ruby/271811.html

猜你在找的Ruby相关文章