Sha256: 10d1ee2c881e243a533b91ce3f2ef619f770b18c77c0c9fb63076406b469234f

Contents?: true

Size: 239 Bytes

Versions: 2

Compression:

Stored size: 239 Bytes

Contents

class PostsController < ApplicationController
  after_action only: [:index] { set_pagination_headers(:posts) }

  def index
    @posts = Post.all.paginate(per_page: params[:per_page], page: params[:page])
    render json: @posts
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
api_pagination_headers-2.1.1 spec/dummy/app/controllers/posts_controller.rb
api_pagination_headers-2.1.0 spec/dummy/app/controllers/posts_controller.rb