Is there a way to get this grape-kaminari to work alongside the grape-jbuilder gem?
I've tried just paginating the records in the actual API module endpoint:
resource :groups do
desc "Return a list of groups belonging to your company."
get "/", jbuilder: "v3/groups" do
paginate(@groups)
end
end
and I've also tried putting the paginate call inside of the jbuilder object:
json.array! paginate(@groups) do |group|
json.partial! "v3/group", group: group, computer_array: false
end
Neither of which worked. Can someone help me make this work?
I finally worked it out. You have to reset the variable to the paginated array like so:
resource :groups do
desc "Return a list of groups belonging to your company."
get "/", jbuilder: "v3/groups" do
@groups = paginate(@groups)
end
end