rails中出现意外的SyntaxError,应为then或''或者'\n'



错误描述为

SyntaxError: /workspace/SiUber/app/views/siuber/search.html.erb:128: syntax error, unexpected in, expecting then or ';' or 'n'
if @se in ss.title
^~/workspace/SiUber/app/views/siuber/search.html.erb:139: syntax error, unexpected end, expecting end-of-input
end
^~~
'`<%
@search.each do |ss| 
if @se in ss.title
%>
<hr>
<h6><a href='<%= ss.link %>'><%= ss.title %></a></h6>
<p>
올린사람 : <%= ss.maker %>
</p>
<hr>
<% end
end %>`

我假设@se是一个数组

所以请尝试下面的代码

<% @search.each do |ss|  %>
<% if @se.include?(ss.title) %>
<hr>
<h6><a href='<%= ss.link %>'><%= ss.title %></a></h6>
<p> 올린사람 : <%= ss.maker %> </p>
<hr>
<% end %>
<% end %>

如果它不起作用,那么请在这里添加完整的代码。

最新更新