0

*当我保存 Sublime 文本并刷新 localhost:3000 时,我不断收到此错误。我该怎么办?


显示 /Users/Matt/code/omrails/app/views/layouts/application.html.erb 其中第 21行提出:

/Users/Matt/code/omrails/app/views/layouts/application.html.erb:21: syntax error, unexpected keyword_ensure, expecting keyword_end
/Users/Matt/code/omrails/app/views/layouts/application.html.erb:23: syntax error, unexpected $end, expecting keyword_end

提取的源代码(在#21行附近):

18:         </div>
19:     </body>
20: </html>

模板包含的痕迹:app/views/layouts/application.html.erb


这就是我的application.html.erb文件的样子:

<!DOCTYPE html>
<html>
<head>
  <title>One Month Rails</title>
  <%= stylesheet_link_tag    "application", :media => "all" %>
  <%= javascript_include_tag "application" %>
  <%= csrf_meta_tags %>
</head>
<body>
    <%= render "layouts/header" %>

    <div class="container">
        <% flash.each do |name, msg| %>
            <%= content_tag(:div, msg, class: "alert alert-#{name}") %>
        <%= yield %>

        <%= render "layouts/footer" %>
    </div>
</body>


我做错什么了???

4

2 回答 2

0
<% flash.each do |name, msg| %>
    <%= content_tag(:div, msg, class: "alert alert-#{name}") %>
<% end %>
于 2013-04-04T21:15:06.320 回答
0

你忘endflash.each do

即右视图是下一个

<!DOCTYPE html>
<html>
<head>
  <title>One Month Rails</title>
  <%= stylesheet_link_tag    "application", :media => "all" %>
  <%= javascript_include_tag "application" %>
  <%= csrf_meta_tags %>
</head>
<body>
    <%= render "layouts/header" %>

    <div class="container">
        <% flash.each do |name, msg| %>
            <%= content_tag(:div, msg, class: "alert alert-#{name}") %>
        <% end %>
        <%= yield %>

        <%= render "layouts/footer" %>
    </div>
</body>
于 2013-04-04T21:15:36.563 回答