Limit “each” list in Rails

前端 未结 3 1476
借酒劲吻你
借酒劲吻你 2021-02-05 11:42

We have this:

<% @shops.each do |shop| %>
  
  • <%= shop.name %>
  • <% end %>

    The code will yield the total res

    3条回答
    •  迷失自我
      2021-02-05 11:48

      Change the code in your controller where @shops is being set, or change the above code to @shops.take(20).each.

    提交回复
    热议问题