Skip to content

Work#83

Merged
PENGZhaoqing merged 2 commits intoPENGZhaoqing:masterfrom
qqgwq:work
Nov 22, 2017
Merged

Work#83
PENGZhaoqing merged 2 commits intoPENGZhaoqing:masterfrom
qqgwq:work

Conversation

@qqgwq
Copy link

@qqgwq qqgwq commented Nov 22, 2017

添加页面的分页,把length换成count 因为count不会加载所有对象,减少查询时间

@PENGZhaoqing
Copy link
Owner

PENGZhaoqing commented Nov 22, 2017

count会触发数据库操作, length是执行完数据库操作后的ruby指令, 前面where已经查询一波了, 所以这里用length啊

https://stackoverflow.com/questions/6083219/activerecord-size-vs-count

@PENGZhaoqing PENGZhaoqing merged commit 15137e6 into PENGZhaoqing:master Nov 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants