Sha256: ebbc83d22310fdadb0e9e44f2778c7481fd9f06a5d2147b0fb43daa25f8ff5f4
Contents?: true
Size: 584 Bytes
Versions: 9
Compression:
Stored size: 584 Bytes
Contents
# Helpful serializer for including pagination meta # Source: http://stackoverflow.com/a/23002614/131208 module Tenon class PaginatingSerializer < ActiveModel::ArraySerializer def initialize(object, options = {}) meta_key = options[:meta_key] || :meta options[meta_key] ||= {} options[meta_key][:pagination] = { current_page: object.current_page, per_page: object.per_page, offset: object.offset, total_pages: object.total_pages, total_entries: object.total_entries } super(object, options) end end end
Version data entries
9 entries across 9 versions & 1 rubygems