9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/api_only_pagination/active_record_paginate.rb', line 9
def do_paginate(page = ApiOnlyPagination.configuration.default_page,
per_page = ApiOnlyPagination.configuration.default_page_size)
= ApiOnlyPagination::Pagination.new(all, { page: page, per_page: per_page })
meta_data = .metadata
ApiOnlyPagination::PaginatedData
.new(data: .results,
per_page: meta_data.per_page,
current_page: page,
total_pages: meta_data.total_pages,
total_records: meta_data.count)
end
|