Module: GrapeListing::Pagination

Included in:
GrapeListingService
Defined in:
lib/listing_service/pagination.rb

Instance Method Summary collapse

Instance Method Details

#paginatedObject



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/listing_service/pagination.rb', line 4

def paginated
  if @objects_count > 0
    search
    paginate
  else
    @objects = []
  end

  # результат с пагинацией
  { count: @objects_count, objects: @objects }
end