Update paginated responses to include summary data
This commit is contained in:
@@ -7,7 +7,12 @@ module Api::V1
|
||||
if params[:state].present?
|
||||
parks = parks.where("states like '%' || ? || '%'", params[:state])
|
||||
end
|
||||
render json: parks.limit(per_page).offset((page - 1) * per_page)
|
||||
render json: {
|
||||
total: parks.count,
|
||||
limit: pagination_limit,
|
||||
offset: pagination_offset,
|
||||
parks: parks.limit(pagination_limit).offset(pagination_offset)
|
||||
}
|
||||
end
|
||||
|
||||
def show
|
||||
|
||||
Reference in New Issue
Block a user