Skip to content
Snippets Groups Projects
Commit c84df7ab authored by Giovanne Marcelo's avatar Giovanne Marcelo
Browse files

add some paginations

parent 3a2d95ae
No related branches found
No related tags found
1 merge request!292Pagination
...@@ -11,9 +11,8 @@ class V1::CollectionsController < ApplicationController ...@@ -11,9 +11,8 @@ class V1::CollectionsController < ApplicationController
# GET /v1/collections # GET /v1/collections
# GET /v1/collections.json # GET /v1/collections.json
def index def index
limit = params[:limit] || 10 collections = paginate Collection.all
offset = params[:offset] || 0 render json: collections
render json: Collection.limit(limit).offset(offset)
end end
# GET /v1/collections/1 # GET /v1/collections/1
......
...@@ -6,7 +6,8 @@ class V1::ComplaintsController < ApplicationController ...@@ -6,7 +6,8 @@ class V1::ComplaintsController < ApplicationController
# GET v1/complaint # GET v1/complaint
# GET v1/complaint.json # GET v1/complaint.json
def index def index
render json: Complaint.all complaints = paginate Complaint.all
render json: complaints
end end
# GET v1/complaint # GET v1/complaint
......
...@@ -7,7 +7,8 @@ class V1::InstitutionsController < ApplicationController ...@@ -7,7 +7,8 @@ class V1::InstitutionsController < ApplicationController
# GET v1/institutions # GET v1/institutions
# GET v1/institutions.json # GET v1/institutions.json
def index def index
render json: Institution.all institutions = paginate Institution.all
render json: institutions
end end
# GET v1/institutions/1 # GET v1/institutions/1
......
...@@ -5,7 +5,8 @@ class V1::LanguagesController < ApplicationController ...@@ -5,7 +5,8 @@ class V1::LanguagesController < ApplicationController
# GET /languages # GET /languages
# GET /languages.json # GET /languages.json
def index def index
render json: Language.all languages = paginate Language.all
render json: languages
end end
# GET /learning_objects/1 # GET /learning_objects/1
......
...@@ -5,7 +5,8 @@ class V1::MimeTypesController < ApplicationController ...@@ -5,7 +5,8 @@ class V1::MimeTypesController < ApplicationController
# GET /mime_types # GET /mime_types
# GET /mime_types.json # GET /mime_types.json
def index def index
render json: MimeType.all mime_types = paginate MimeType.all
render json: mime_types
end end
# GET /mime_types/1 # GET /mime_types/1
......
...@@ -5,7 +5,8 @@ class V1::ObjectTypesController < ApplicationController ...@@ -5,7 +5,8 @@ class V1::ObjectTypesController < ApplicationController
# GET /object_types # GET /object_types
# GET /object_types.json # GET /object_types.json
def index def index
render json: ObjectType.includes(:mime_types).all object_types = paginate ObjectType.includes(:mime_types).all
render json: object_types
end end
# GET /learning_objects/1 # GET /learning_objects/1
......
...@@ -5,7 +5,8 @@ class V1::RolesController < ApplicationController ...@@ -5,7 +5,8 @@ class V1::RolesController < ApplicationController
# GET /roles # GET /roles
# GET /roles.json # GET /roles.json
def index def index
render json: Role.all roles = paginate Role.all
render json: roles
end end
# GET /roles/1 # GET /roles/1
......
...@@ -8,7 +8,8 @@ class V1::UsersController < ApplicationController ...@@ -8,7 +8,8 @@ class V1::UsersController < ApplicationController
# GET /v1/users # GET /v1/users
# GET /v1/users.json # GET /v1/users.json
def index def index
render json: User.all users = paginate User.all
render json: users
end end
# GET /v1/users/1 # GET /v1/users/1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment