我正在使用St. Laurent & Edd Dumbill的Learning Rails書籍。從上面chp3中的佈局練習中拆分視圖時,我收到了缺少的模板錯誤。從佈局分割視圖時缺少模板錯誤
請幫我理解爲什麼會發生下面的錯誤。
模板丟失 缺少佈局佈局/ hello.html.erb鑑於路徑C:/ InstantRails的/ rails_apps /你好/應用/視圖
控制器信息: 名稱:hello_controller
路徑:C :\ INSTAN〜1個\ rails_apps \你好\應用\控制器
代碼:
class HelloController <ApplicationController
def index
@message="Hello!"
@count=3
@bonus="This message came from the controller."
end
端
查看信息:
名稱:index.html的
路徑:C:\ INSTAN〜1個\ rails_apps \你好\程序\意見\你好
代碼:
<h1><%=h @message %></h1>
<p>This is a greeting from app/views/hello/index.html.erb</p>
<% for i in [email protected] %>
<p><%= @bonus %></p>
<% end %>
姓名:hello.html.erb
路徑: C:\ INSTAN〜1 \ rails_apps \ hello \ app \ views \ layouts
代碼:
<html>
<head><title><%=h @message %> </title>
<% stylesheet_link_tag 'hello' %>
</head>
<body>
(using layout)
<!--layout will incorporate view-->
<%= yield :layout %>
</body>
</html>
請繼續閱讀並瞭解有關調試Rails應用程序的信息http://nofail.de/2013/10/debugging-rails-applications-in-development/ – phoet