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

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

前端erb 页面: 

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

后端controller:  调用.without_count 方法

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

This post is licensed under CC BY 4.0 by the author.
Contents