开发者

Problem with stylesheet_link_tag

I have add stylesheet link tag to my application. I'm sure its worked. because in another place is working. but if I run at my computer it did not working. I mean my application cant load css

when I seen at view source the result is :

<script src="http://localhost:3000//javascripts/application.js?1258048544" type="text/javascript"></script>

<link href="http://localhost:3000//stylesheets/jqu开发者_运维问答ery.autocomplete.css?1258048544" media="screen" rel="stylesheet" type="text/css" />

I'm sure it shouldnt appear double slash // after domain or localhost:3000. weird why in other computer it was worked.

Have you any suggestion for this case? how to change double slash with single?

btw I use ubuntu.


The Rails helpers should not render an absolute url, it should simply be a relative path.

<link href="/stylesheets/jquery.autocomplete.css?1250281505" media="screen" rel="stylesheet" type="text/css" />

Make sure you are using the stylesheet_link_tag properly - do not use a leading slash or the trailing .css when specifying the stylesheet name. Same for javascript_include_tag.

<%= stylesheet_link_tag "jquery.autocomplete" %>


Maybe this helps:

Relative paths from root-stucture: "/your/path/to/file.ext"

Relative paths from the current file "your/path/to/file.ext"


Try these helper methods:

<%= stylesheet_link_merged 'jquery.autocomplete.css' %>
<%= javascript_include_tag 'application.js'%>

*Works with http://synthesis.sbecker.net/pages/asset_packager


I had a similar problem and just discovered the issue–it may or may not work for you.

My app uses the Facebooker gem to integrate with Facebook Connect. In my facebooker.yml file, if I had a trailing slash in my callback_url setting, I would get the same behavior as you described. Removing the trailing slash fixed the issue.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜