我刚刚开始了 Michael Hartl 编写的 Ruby on Rails 教程的第 5 课:填充布局添加一些结构
虽然我的更改自第 3 课后期以来一直没有呈现。当我在任何页面(home.html.erb、about.html.erb 等)中进行更改时,我没有任何问题。但是诸如登录和标题之类的内容不会改变。
应用程序.html.erb
<!DOCTYPE html>
<html>
<head>
<title><%= full_title(yield(:title)) %></title>
<%= stylesheet_link_tag "application", media: "all",
"data-turbolinks-track" => true %>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%= csrf_meta_tags %>
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<header class="navbar navbar-fixed-top navbar-inverse">
<div class="navbar-inner">
<div class="container">
<%= link_to "sample app", '#', id: "logo" %>
<nav>
<ul class="nav pull-right">
<li><%= link_to "Home", '#' %></li>
<li><%= link_to "Help", '#' %></li>
<li><%= link_to "Sign in", '#' %></li>
</ul>
</nav>
</div>
</div>
</header>
<section>
<%= yield %>
</section>
</body>
</html>
路线.rb
SampleApp::Application.routes.draw do
get "pages/home"
get "pages/contact"
get "pages/about"
end
主页.html.erb
<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>
同样,我的页面只是呈现了它在第三章中所做的,没有样式表,没有更改导航栏,并且标题不正确(localhost:3000/pages/home)而不是 Ruby on Rails 示例应用程序。