Rails语法错误:意外的keyword_ensure,期望输入结束

tri*_*ror 8 ruby ruby-on-rails ruby-on-rails-3

我是rails的新手,我尝试根据教程创建一个论坛应用程序.这是我的论坛页面,但我一直收到错误:

syntax error, unexpected keyword_ensure, expecting end-of-input

Extracted source (around line #33):
30 
31    <p><% if admin? %><%= link_to "New Forum", new_forum_path %><% end %></p>  
Run Code Online (Sandbox Code Playgroud)

这是抛出错误的论坛索引页面:

<% title "Forums" %>  

<table>  
  <tr>  
    <th width="70%">Forum</th>  
    <th width="30%">Last Post</th>  
  </tr>  
  <% for forum in @forums %>  
    <tr>  
      <td><h4><%= link_to h(forum.name), forum_path(forum.id) %></h4>  
        <small><%= forum.topics.count %> topics</small><br />  
        <%=h forum.description %></td>  
      <td class="right">
      <% if forum.most_recent_post %>
      <%= distance_of_time_in_words_to_now forum.most_recent_post.last_post_at %>
       ago by 
       <%= link_to forum.most_recent_post.user.username, "/users/#{forum.most_recent_post.last_poster_id}" %>
       <% else %>no posts<% end %>
       </td>  
      <% if admin? %>
      <td><%= link_to "Edit", edit_forum_path(forum) %>
  <% end %></td>
  <!-- <% end %> -->  
  <% if admin? %>
  <td><%= link_to "Destroy", forum, :confirm => 'Are you sure?', :method => :delete %></td>
  <% end %>  
</tr>  
  <% end %>  
Run Code Online (Sandbox Code Playgroud)

<p><% if admin? %><%= link_to "New Forum", new_forum_path %><% end %></p>  
Run Code Online (Sandbox Code Playgroud)

ami*_*ine 1

我所看到的错误是你在它应该在这里之前设置了结束

      <% if admin? %>
      <td><%= link_to "Edit", edit_forum_path(forum) %>
  <% end %></td>
Run Code Online (Sandbox Code Playgroud)

所以尝试像这样移动它

      <% if admin? %>
      <td><%= link_to "Edit", edit_forum_path(forum) %>
  </td><% end %>
Run Code Online (Sandbox Code Playgroud)