Skip to content
Snippets Groups Projects
Commit 7cbbdda2 authored by Mateus Rambo Strey's avatar Mateus Rambo Strey
Browse files

add offset and limit to learning objects index

parent a1cce81c
No related branches found
No related tags found
No related merge requests found
...@@ -12,6 +12,8 @@ class V1::LearningObjectsController < ApplicationController ...@@ -12,6 +12,8 @@ class V1::LearningObjectsController < ApplicationController
before_action :authorize!, only: [:show, :update, :destroy] before_action :authorize!, only: [:show, :update, :destroy]
def index def index
limit = params[:limit] || 10
offset = params[:offset] || 0
serializer = params[:obaa].nil? ? LearningObjectSerializer : LearningObjectObaaSerializer serializer = params[:obaa].nil? ? LearningObjectSerializer : LearningObjectObaaSerializer
render json: LearningObject.limit(limit).offset(offset).all, each_serializer: serializer render json: LearningObject.limit(limit).offset(offset).all, each_serializer: serializer
end end
......
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