下面的代码给出了错误:
/home/nish/staging/app/views/product_search/_products.html.erb:31: syntax error, unexpected keyword_ensure, expecting $end
<% if products.any? %>
<%= render :partial=> 'product_listing_feature', :locals => {:scope => scope, :scope_type => scope_type} %>
<ul class="products" data-hook class="products">
<div id="ql_product"></div>
<div class="page">
<taxons.each do |taxon|>
<% taxonProducts = Array.new %>
<% products.each do |product| %>
<%@ptaxon = product.get_taxonomy%>
<%if @ptaxon == taxonomy%>
<% taxonProducts.push(product) %>
<% end %>
<% end %>
<%= render :partial=> 'product_listing', :locals=>{:collection=> taxonProducts} %>
</div>
<% end %>
</div>
</ul>
<% end %>
我发现当<%end%>
代码中有多余内容时,会发生此错误。我觉得我end
在适当的地方使用过。无法找出问题所在
<taxons.each do |taxon|>
应该 :
<% taxons.each do |taxon| %>
它只是您编写时的纯文本,而不是ruby解释的。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句