我的索引页面未链接到位于public / stylesheets中的stylesheets文件夹

时间:2014-05-24 17:28:05

标签: ruby-on-rails-3

我有以下观点

app/views/people/index.html.erb 

和布局app /views/layout/application.html.erb

application.html.erb

的内容
<link href="/assets/all.css" media="screen" rel="stylesheet" type="text/css" />
<script src="/assets/defaults.js" type="text/javascript"></script>  

但是当我去localserver:3000/people

public / stylesheets文件夹的样式未应用

源代码localserver:3000 / people

<link href="/assets/all.css" media="screen" rel="stylesheet" type="text/css" />
<script src="/assets/defaults.js" type="text/javascript"></script>

1 个答案:

答案 0 :(得分:0)

将此行添加到index.html.erb应该可以解决问题

<%= stylesheet_link_tag "all" %>

有关详情,请参阅 API