Rails:语法错误,意外的keyword_ensure,期望$ end

问题描述:

我正在创建一个非常基本的Rails应用程序(学习教程),但无法理解为什么会出现此错误。我曾尝试过疑难解答,但无济于事。

I'm creating a very basic rails app (learning tutorial) and can't understand why I'm getting this error. I've tried troubleshooting but to no avail.

我的代码:

<ul class = "nav pull-right">
  <% if user_signed_in? %>
    <li><%= link_to current_user.full_name, edit_user_registration_path %></li>
    <li><%= link_to "Log Out", destroy_user_session_path, method: :delete %></li>
  <% end %> 

  <% else %>

    <li><%= link_to "Log In", new_user_session_path %></li>
    <li><%= link_to "Sign Up", new_user_registration_path %></li>
  <%end%>

</ul>

一切正常,直到我添加了Else语句,但不知道我的错误是什么-我'肯定这是一个非常小的语法修复程序,但是您的帮助将不胜感激。

Everything was working fine, until I added the Else statement, but no idea what my error is - I'm sure it's a very minor syntax fix, but your help would be much appreciated.

您的代码中有错误。

else 开始之前,您的代码中就有额外的 end

删除可能会解决您的问题...

there has an error in your code.
You have extra end in your code before the else starts.
Removing that may solve your problem...