FIX: Incorrect count when loading more groups.

This commit is contained in:
Guo Xiang Tan
2016-12-20 14:38:27 +08:00
parent 193f8301a4
commit 502e114c60
2 changed files with 4 additions and 1 deletions

View File

@ -20,11 +20,12 @@ class GroupsController < ApplicationController
groups = groups.where(automatic: false)
end
count = groups.count
groups = groups.offset(page * page_size).limit(page_size)
render json: {
groups: serialize_data(groups, BasicGroupSerializer),
total_rows_groups: Group.count,
total_rows_groups: count,
load_more_groups: groups_path(page: page + 1)
}
end