1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-04 15:24:23 +01:00
fab-manager/app/controllers/open_api/v1/events_controller.rb
2016-05-05 15:02:02 +02:00

19 lines
380 B
Ruby

class OpenAPI::V1::EventsController < OpenAPI::V1::BaseController
extend OpenAPI::ApiDoc
expose_doc
def index
@events = Event.order(created_at: :desc)
if params[:page].present?
@events = @events.page(params[:page]).per(per_page)
paginate @events, per_page: per_page
end
end
private
def per_page
params[:per_page] || 20
end
end