Back

ruby - rails 分页: will paginate, 对于大数据量,不要用@count ,会引起加载缓慢,要使用without

发布时间: 2020-10-17 06:28:00

前端erb 页面: 

<%= link_to_prev_page @trades, "上一页" %>
<%= link_to_next_page @trades, "下一页" %>

后端controller:  调用.without_count 方法

@trades.page(params[:page]).per(1000).without_count

Back