问题
I am using Rails 3.1.1 and have a website with a setting of stylesheets that changes over the year according to seasons etc, like this:
<%= stylesheet_link_tag "application" %>
<%= stylesheet_link_tag 'themes/theme_winter.css' %>
with the theme_winter.css
is placed in a folder called themes
in the stylesheet-folder.
I am using Memcachier so online it looks like this:
<link href="/assets/application-75b2717254d80c8ed37d5f955e2a0287.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/assets/themes/theme_winter-a5de7f8f92d3d03061fd6aeb23ca2c40.css" media="screen" rel="stylesheet" type="text/css" />
This works perfectly fine on my local machine but on Heroku the winter-stylesheet (and similar) won't load. If I watch the page source and click the link (in the page source, in order to look at the css) I get this error shown in my web browser:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<HTML>
<HEAD><TITLE>Internal Server Error</TITLE></HEAD>
<BODY>
<H1>Internal Server Error</H1>
undefined method `each' for nil:NilClass
<HR>
<ADDRESS>
WEBrick/1.3.1 (Ruby/1.9.2/2011-07-09) at
www.mydomain.com:80
</ADDRESS>
</BODY>
</HTML>
I can't really see why it is referring to undefined method
each' for nil:NilClass`. It doesn't make sense!
I believe the problem is related to caches because it used to work before I implemented Memcachier, but I could also remember this wrong.
No matter what, I have tried to add :cache => false
and uploaded new files with git add -A
but without any luck.
I really cannot see what is going wrong. I have never seen an error like this in the CSS! Could you help me?
回答1:
This seems to have been related to this issue, why I do not know. But the problem seems to have been related to me not having memcachier gem installed.
来源:https://stackoverflow.com/questions/12910158/css-returns-internal-server-error-on-heroku