我正在研究Ruby on Rails教程http://railstutorial.org/,第4章,清单4.4.我已插入两行调用stylesheet_link_tag,但链接未插入最终页面.这是我的application.html.erb:
<!DOCTYPE html>
<html>
<head>
<title><%= title %></title>
<%= csrf_meta_tag %>
<% stylesheet_link_tag 'blueprint/screen', :media => 'screen' %>
<% stylesheet_link_tag 'blueprint/print', :media => 'print' %>
</head>
<body>
<%= yield %>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
这是http:// localhost:3000/pages/home的输出
<!DOCTYPE html>
<html>
<head>
<title>Ruby on Rails Tutorial Sample App | Home</title>
<meta name="csrf-param" content="authenticity_token"/>
<meta name="csrf-token" content="D8xx1zqWM5qqwqdabyjy5eHLPvLY/Sxe5vEFJ816fMY="/>
</head>
<body>
<h1>Sample App</h1>
<p>
This is the home page for the
<a href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
sample application
</p>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我自己复制,粘贴和输入,我得到的结果相同.建议?
谢谢,查克
这是产生输出所以它需要在输出到模板的erb块中:
<%= stylesheet_link_tag 'blueprint/screen', :media => 'screen' %>
Run Code Online (Sandbox Code Playgroud)
您正在使用的块类型:
<% stylesheet_link_tag 'blueprint/screen', :media => 'screen' %>
Run Code Online (Sandbox Code Playgroud)
没有将结果打印到模板中.
| 归档时间: |
|
| 查看次数: |
1178 次 |
| 最近记录: |