1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-10 21:24:20 +01:00
fab-manager/app/controllers/open_api/v1/events_controller.rb

16 lines
339 B
Ruby
Raw Normal View History

2016-05-04 18:17:50 +02:00
class OpenAPI::V1::EventsController < OpenAPI::V1::BaseController
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