Skip to content
Snippets Groups Projects
Commit a10cca95 authored by Marcela Ribeiro de Oliveira's avatar Marcela Ribeiro de Oliveira
Browse files

Paginate the results of get request from LearningObjects.all

parent 6a2db950
No related branches found
No related tags found
No related merge requests found
...@@ -3,13 +3,15 @@ require 'uri' ...@@ -3,13 +3,15 @@ require 'uri'
class V1::LearningObjectsController < ApplicationController class V1::LearningObjectsController < ApplicationController
include ::SociableController include ::SociableController
include ::TaggableController include ::TaggableController
include ::Paginator
before_action :authenticate_user!, except: [:index, :show] before_action :authenticate_user!, except: [:index, :show]
before_action :set_learning_object, only: [:show, :create, :update, :destroy] before_action :set_learning_object, only: [:show, :create, :update, :destroy]
before_action :authorize! before_action :authorize!
def index def index
render json: LearningObject.all #@learning_objects = LearningObject.all
render json: LearningObject.limit(limit).offset(offset).all
end end
# GET /learning_objects/1 # GET /learning_objects/1
......
class LearningObjectSerializer < ActiveModel::Serializer class LearningObjectSerializer < ActiveModel::Serializer
attributes :id, :name, :created_at, :updated_at, :description, :author, :score attributes :id , :name, :created_at, :updated_at, :description, :author, :score, :likes_count
has_many :tags has_many :tags
has_many :attachments has_many :attachments
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