From 60d84ffc7cd633d8fa68a1a23d1df95ee8e0e255 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Thu, 8 Oct 2015 02:54:16 +0300 Subject: [PATCH] Add a halfnarp-friendly version of the events API --- app/controllers/api/events_controller.rb | 5 +++++ config/routes.rb | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/events_controller.rb b/app/controllers/api/events_controller.rb index 1be0cc6..ca6ec1c 100644 --- a/app/controllers/api/events_controller.rb +++ b/app/controllers/api/events_controller.rb @@ -5,4 +5,9 @@ class Api::EventsController < Api::ApplicationController def index @events = current_conference.events.includes(:participations) end + + def halfnarp_friendly + @events = current_conference.events.includes(:track, :event_type) + render json: @events, include: [:track, :event_type] + end end diff --git a/config/routes.rb b/config/routes.rb index 08149b9..8ef59e1 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -13,7 +13,11 @@ Rails.application.routes.draw do namespace :api do resources :conferences, only: [] do - resources :events, only: :index + resources :events, only: :index do + collection do + get :halfnarp_friendly + end + end resources :speakers, only: :index resources :tracks, only: :index resources :event_types, only: :index