开发者

Rails Production server: stylesheets not displaying!

I just switched over from my development database to the production database, and I realized I'm getting a consistent error nomatter what view I try to open. The stylesheets are not loading correctly, despite being in the correct place.

Here's some information about the error:

开发者_如何学Go

View

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

Console

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)

Page Source

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

When I try to open the 'global' and 'home' stylesheets from the page source, they are not opened. I tried adding 'public/' to the URL but it says no route matches.

Location

All non-http stylesheets are in root/public/stylesheets/

Routes

The last two routes are the 'catch-alls', only there for a particular feature on the site. These seem to be catching my stylesheets (and possibly other tags too).

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


This thread has some suggestions...

Depending on your webserver you may have to change the following setting in config/environments/prodcution.rb from:

config.serve_static_assets = false

To:

config.serve_static_assets = true
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜