Hi, I'm using this gem to communicate with an iOS app, my config is as so
PagerApi.setup do |config|
# Pagination Handler
# User this option to meet your pagination handler, whether is :kaminari or :will_paginate
config.pagination_handler = :kaminari
# Includes Pagination information on Meta
#
config.include_pagination_on_meta = true
# Includes Pagination information on a Link Header
#
config.include_pagination_headers = true
# Set the Total-Count Header name
config.total_count_header = "X-Total-Count"
end
and I 'm using it like so in my controllers
def index paginate Registration.all, per_page: 1 end
The response I get is as below
[ { "paid_at" : null, "status" : "pending", "sponsorship_id" : null, "user_id" : 1, "course_id" : 1, "updated_at" : "2016-06-01T10:39:34.262+08:00", "transaction_id" : null, "fees_paid_cents" : 0, "referrer_id" : null, "graduate_status" : "not_graduated", "payment_method" : null, "total_paid_cents" : 0, "tax_paid_cents" : 0, "id" : "c0d47566-f5b3-4217-81df-79ef3bb8267f", "book_entry_record_url" : "https:\/\/sg.qbo.intuit.com\/app\/salesreceipt?txnId=", "referrer_paid_at" : null, "referrer_transaction_id" : null, "created_at" : "2016-06-01T10:39:34.262+08:00", "total_paid_currency" : "MYR", "tax_paid_currency" : "MYR", "fees_paid_currency" : "MYR" } ] [ { "paid_at" : null, "status" : "pending", "sponsorship_id" : null, "user_id" : 1, "course_id" : 1, "updated_at" : "2016-06-01T10:39:34.262+08:00", "transaction_id" : null, "fees_paid_cents" : 0, "referrer_id" : null, "graduate_status" : "not_graduated", "payment_method" : null, "total_paid_cents" : 0, "tax_paid_cents" : 0, "id" : "c0d47566-f5b3-4217-81df-79ef3bb8267f", "book_entry_record_url" : "https:\/\/sg.qbo.intuit.com\/app\/salesreceipt?txnId=", "referrer_paid_at" : null, "referrer_transaction_id" : null, "created_at" : "2016-06-01T10:39:34.262+08:00", "total_paid_currency" : "MYR", "tax_paid_currency" : "MYR", "fees_paid_currency" : "MYR" }, { "paid_at" : null, "status" : "pending", "sponsorship_id" : null, "user_id" : 2, "course_id" : 1, "updated_at" : "2016-06-01T10:39:34.337+08:00", "transaction_id" : null, "fees_paid_cents" : 0, "referrer_id" : null, "graduate_status" : "not_graduated", "payment_method" : null, "total_paid_cents" : 0, "tax_paid_cents" : 0, "id" : "2e0050ec-2e37-4a85-88b4-86c63c9a829d", "book_entry_record_url" : "https:\/\/sg.qbo.intuit.com\/app\/salesreceipt?txnId=", "referrer_paid_at" : null, "referrer_transaction_id" : null, "created_at" : "2016-06-01T10:39:34.337+08:00", "total_paid_currency" : "MYR", "tax_paid_currency" : "MYR", "fees_paid_currency" : "MYR" }, { "paid_at" : null, "status" : "pending", "sponsorship_id" : null, "user_id" : 3, "course_id" : 1, "updated_at" : "2016-06-01T10:39:34.361+08:00", "transaction_id" : null, "fees_paid_cents" : 0, "referrer_id" : null, "graduate_status" : "not_graduated", "payment_method" : null, "total_paid_cents" : 0, "tax_paid_cents" : 0, "id" : "a9c49040-efb5-42f5-ba44-a92020cd8c22", "book_entry_record_url" : "https:\/\/sg.qbo.intuit.com\/app\/salesreceipt?txnId=", "referrer_paid_at" : null, "referrer_transaction_id" : null, "created_at" : "2016-06-01T10:39:34.361+08:00", "total_paid_currency" : "MYR", "tax_paid_currency" : "MYR", "fees_paid_currency" : "MYR" }, { "paid_at" : null, "status" : "pending", "sponsorship_id" : 1, "user_id" : 4, "course_id" : 1, "updated_at" : "2016-06-01T10:39:34.386+08:00", "transaction_id" : null, "fees_paid_cents" : 0, "referrer_id" : null, "graduate_status" : "not_graduated", "payment_method" : null, "total_paid_cents" : 0, "tax_paid_cents" : 0, "id" : "5d7cd71f-4522-45de-974c-a7748918f377", "book_entry_record_url" : "https:\/\/sg.qbo.intuit.com\/app\/salesreceipt?txnId=", "referrer_paid_at" : null, "referrer_transaction_id" : null, "created_at" : "2016-06-01T10:39:34.386+08:00", "total_paid_currency" : "MYR", "tax_paid_currency" : "MYR", "fees_paid_currency" : "MYR" }, { "paid_at" : null, "status" : "pending", "sponsorship_id" : null, "user_id" : 5, "course_id" : 1, "updated_at" : "2016-06-01T10:39:34.411+08:00", "transaction_id" : null, "fees_paid_cents" : 0, "referrer_id" : null, "graduate_status" : "not_graduated", "payment_method" : null, "total_paid_cents" : 0, "tax_paid_cents" : 0, "id" : "3eb2f267-38ed-462a-aa2a-875a3e95e0db", "book_entry_record_url" : "https:\/\/sg.qbo.intuit.com\/app\/salesreceipt?txnId=", "referrer_paid_at" : null, "referrer_transaction_id" : null, "created_at" : "2016-06-01T10:39:34.411+08:00", "total_paid_currency" : "MYR", "tax_paid_currency" : "MYR", "fees_paid_currency" : "MYR" }, { "paid_at" : null, "status" : "pending", "sponsorship_id" : null, "user_id" : 6, "course_id" : 1, "updated_at" : "2016-06-01T10:39:34.433+08:00", "transaction_id" : null, "fees_paid_cents" : 0, "referrer_id" : null, "graduate_status" : "not_graduated", "payment_method" : null, "total_paid_cents" : 0, "tax_paid_cents" : 0, "id" : "9d96a727-f274-4586-973e-be477130ef26", "book_entry_record_url" : "https:\/\/sg.qbo.intuit.com\/app\/salesreceipt?txnId=", "referrer_paid_at" : null, "referrer_transaction_id" : null, "created_at" : "2016-06-01T10:39:34.433+08:00", "total_paid_currency" : "MYR", "tax_paid_currency" : "MYR", "fees_paid_currency" : "MYR" }, { "paid_at" : null, "status" : "pending", "sponsorship_id" : null, "user_id" : 8, "course_id" : 1, "updated_at" : "2016-06-01T10:39:34.470+08:00", "transaction_id" : null, "fees_paid_cents" : 0, "referrer_id" : null, "graduate_status" : "not_graduated", "payment_method" : null, "total_paid_cents" : 0, "tax_paid_cents" : 0, "id" : "0ee9c953-64a0-4647-96e9-274cfa7f6a50", "book_entry_record_url" : "https:\/\/sg.qbo.intuit.com\/app\/salesreceipt?txnId=", "referrer_paid_at" : null, "referrer_transaction_id" : null, "created_at" : "2016-06-01T10:39:34.470+08:00", "total_paid_currency" : "MYR", "tax_paid_currency" : "MYR", "fees_paid_currency" : "MYR" }, { "paid_at" : null, "status" : "pending", "sponsorship_id" : null, "user_id" : 9, "course_id" : 1, "updated_at" : "2016-06-01T10:39:34.493+08:00", "transaction_id" : null, "fees_paid_cents" : 0, "referrer_id" : null, "graduate_status" : "not_graduated", "payment_method" : null, "total_paid_cents" : 0, "tax_paid_cents" : 0, "id" : "5ce71f97-84dc-42bf-872a-ce6f483de19e", "book_entry_record_url" : "https:\/\/sg.qbo.intuit.com\/app\/salesreceipt?txnId=", "referrer_paid_at" : null, "referrer_transaction_id" : null, "created_at" : "2016-06-01T10:39:34.493+08:00", "total_paid_currency" : "MYR", "tax_paid_currency" : "MYR", "fees_paid_currency" : "MYR" }, { "paid_at" : null, "status" : "pending", "sponsorship_id" : null, "user_id" : 10, "course_id" : 1, "updated_at" : "2016-06-01T10:39:34.518+08:00", "transaction_id" : null, "fees_paid_cents" : 0, "referrer_id" : null, "graduate_status" : "not_graduated", "payment_method" : null, "total_paid_cents" : 0, "tax_paid_cents" : 0, "id" : "f2de4b51-24a4-4628-b144-bf386bc27ac5", "book_entry_record_url" : "https:\/\/sg.qbo.intuit.com\/app\/salesreceipt?txnId=", "referrer_paid_at" : null, "referrer_transaction_id" : null, "created_at" : "2016-06-01T10:39:34.518+08:00", "total_paid_currency" : "MYR", "tax_paid_currency" : "MYR", "fees_paid_currency" : "MYR" }, { "paid_at" : null, "status" : "pending", "sponsorship_id" : null, "user_id" : 11, "course_id" : 1, "updated_at" : "2016-06-01T10:39:34.542+08:00", "transaction_id" : null, "fees_paid_cents" : 0, "referrer_id" : null, "graduate_status" : "not_graduated", "payment_method" : null, "total_paid_cents" : 0, "tax_paid_cents" : 0, "id" : "9917b6c7-57cd-4ef9-968c-d9feaf0b24d4", "book_entry_record_url" : "https:\/\/sg.qbo.intuit.com\/app\/salesreceipt?txnId=", "referrer_paid_at" : null, "referrer_transaction_id" : null, "created_at" : "2016-06-01T10:39:34.542+08:00", "total_paid_currency" : "MYR", "tax_paid_currency" : "MYR", "fees_paid_currency" : "MYR" } ]
I cant get the metadata to appear.
I noticed changing the paginate method in kaminari.rb from render options to return options makes it work.