加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-16 19:43:59 所属栏目:百科 来源:网络整理
导读:我刚从我的开发数据库切换到生产数据库,我意识到我正在得到一个一致的错误nomatter我试图打开什么样的视图.尽管在正确的位置,样式表未正确加载. 以下是有关错误的一些信息: 视图 head%= stylesheet_link_tag "global","home","http://static.flowplayer.org
我刚从我的开发数据库切换到生产数据库,我意识到我正在得到一个一致的错误nomatter我试图打开什么样的视图.尽管在正确的位置,样式表未正确加载.

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

视图

<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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读