![](/img/trans.png)
[英]syntax error, unexpected '\n', expecting => (SyntaxError)
[英]rails SyntaxError unexpected in, expecting then or ';' or '\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 %>
如果它不起作用,請在此處添加完整的代碼。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.