Add a halfnarp-friendly version of the events API

This commit is contained in:
Petko Bordjukov 2015-10-08 02:54:16 +03:00
parent bf278693b3
commit 60d84ffc7c
2 changed files with 10 additions and 1 deletions

View File

@ -5,4 +5,9 @@ class Api::EventsController < Api::ApplicationController
def index def index
@events = current_conference.events.includes(:participations) @events = current_conference.events.includes(:participations)
end end
def halfnarp_friendly
@events = current_conference.events.includes(:track, :event_type)
render json: @events, include: [:track, :event_type]
end
end end

View File

@ -13,7 +13,11 @@ Rails.application.routes.draw do
namespace :api do namespace :api do
resources :conferences, only: [] 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 :speakers, only: :index
resources :tracks, only: :index resources :tracks, only: :index
resources :event_types, only: :index resources :event_types, only: :index