Module: Dune::Api::PaginatedController

Extended by:
ActiveSupport::Concern
Included in:
V1::ChannelsController, V1::ContributionsController, V1::PressAssetsController, V1::ProjectsController, V1::TagsController, V1::UsersController
Defined in:
lib/dune/api/paginated_controller.rb

Instance Method Summary collapse

Instance Method Details

#respond_with_pagination(collection) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/dune/api/paginated_controller.rb', line 10

def respond_with_pagination(collection)
  render json: collection, meta: {
    page:        collection.current_page,
    total:       collection.total_count,
    total_pages: collection.total_pages
  }
end