Rails:语法错误,意外的keyword_ensure,期望$ end [英] Rails: syntax error, unexpected keyword_ensure, expecting $end

查看:67
本文介绍了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...

这篇关于Rails:语法错误,意外的keyword_ensure,期望$ end的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆