系統創建頁面http://localhost:3000/pages/home顯示正常。但是當我更改文件home.html.erb的內容並在瀏覽器中重新加載頁面並查看源代碼時,我看到我的home.html.erb文件中的內容被添加到自動創建的內容下。所以基本上在源代碼中有兩個頁面。誰知道是什麼原因造成的?Ruby on Rails 3教程Michael Hartl - 第3課靜態頁面問題
我application.html.erb:
<!DOCTYPE html>
<html>
<head>
<title>SampleApp</title>
<%= stylesheet_link_tag :all %>
<%= javascript_include_tag :defaults %>
<%= csrf_meta_tag %>
</head>
<body>
<%= yield %>
</body>
</html>
我home.html.erb
<!DOCTYPE html>
<html>
<head>
<title>Ruby on Rails Tutorial Sample App | Home</title>
</head>
<body>
<h1>Sample App</h1>
...
</body>
</html>
你可以發佈你的'app/view/layouts/application.html.erb'和'app/view/pages/home.html.erb'嗎? – Jin