Commit c9e541cc authored by Douglas AC's avatar Douglas AC

Paginating index request of "object_types" and "subjects".

parent ad47f156
......@@ -28,7 +28,7 @@ class V1::ObjectTypesController < ApplicationController
# GET /object_types
# GET /object_types.json
def index
object_types = policy_scope(ObjectType).includes(:mime_types)
object_types = paginate policy_scope(ObjectType).includes(:mime_types)
render json: object_types
end
......
......@@ -18,6 +18,9 @@
# along with portalmec. If not, see <http://www.gnu.org/subjects/>.
class V1::SubjectsController < ApplicationController
include ::Paginator
before_action :authenticate_user!, except: [:show, :destroy, :index]
before_action :set_subject, only: [:show, :update, :destroy]
before_action :authorize!, only: [:update ]
......@@ -26,7 +29,7 @@ class V1::SubjectsController < ApplicationController
# GET /subjects
# GET /subjects.json
def index
subjects = policy_scope(Subject)
subjects = paginate policy_scope(Subject)
render json: subjects
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment