所以我有这个 ERB 部分,它根据传递的本地参数呈现不同的部分:
<% unless current_user?(@user) do %>
<div id="relation">
<% if current_user.friends?(@user) %>
<%= render('edit-relation', locals: { action: "rm-friend" })%>
<% elsif current_user.req_friends?(@user) %>
Friend Request Pending...
<% elsif current_user.pend_friends?(@user) %>
<%= render('edit-relation', locals: { action: "add-friend" })%>
<%= render('edit-relation', locals: { action: "rej-friend" })%>
<% else %>
<%= render('edit-relation', locals: { action: "req-friend" })%>
<% end %>
</div>
<% end %>
它抛出语法错误:
Showing C:/Users/HP/Ubuntu One/A2 Computing Project/Software Development/Client/app/views/layouts/_relation.html.erb where line #15 raised:
C:/Users/HP/Ubuntu One/A2 Computing Project/Software Development/Client/app/views/layouts/_relation.html.erb:15: syntax error, unexpected keyword_ensure, expecting keyword_end
C:/Users/HP/Ubuntu One/A2 Computing Project/Software Development/Client/app/views/layouts/_relation.html.erb:17: syntax error, unexpected end-of-input, expecting keyword_end
没有第 15 行或第 17 行。有人知道出了什么问题吗?