gpt4 book ai didi

ruby-on-rails - Rails 生产服务器 : stylesheets not displaying!

转载 作者:技术小花猫 更新时间:2023-10-29 10:28:59 26 4
gpt4 key购买 nike

我刚刚从我的开发数据库切换到生产数据库,我意识到无论我尝试打开什么 View ,我都会遇到一个一致的错误。尽管样式表位于正确的位置,但仍未正确加载。

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

查看

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

控制台

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)

页面源

<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/

路线

最后两条路线是“包罗万象”,仅适用于网站上的特定功能。这些似乎正在捕获我的样式表(可能还有其他标签)。

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

最佳答案

thread有一些建议...

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

config.serve_static_assets = false

收件人:

config.serve_static_assets = true

关于ruby-on-rails - Rails 生产服务器 : stylesheets not displaying!,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3939513/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com