有人可以给我建议吗。如何推送内容以查询结果。例如:
@products = Product.where('active =?',true)
现在我想在每9 .. 10,14 .. 15,20 .. 21结果之间推送广告框。
您将必须在视图中执行此操作。
<%advertise_index = [9, 14, 20]%>
<%@products.each_with_index do |product, i|%>
<%= product.name%> #whatever you want to show about the product
<%if advertise_index.include?(i)%>
#add advertise box
<%end%>
<%end%>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句