Introduce a rudimentary JSON export of events

This commit is contained in:
Petko Bordjukov 2015-10-05 15:24:37 +03:00
parent a5b1515081
commit 5ecafd9573
3 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,2 @@
class Api::ApplicationController < ::ApplicationController
end

View File

@ -0,0 +1,14 @@
class Api::EventsController < Api::ApplicationController
def index
@conference = find_conference
@events = @conference.events.includes(:track)
render json: @events, include: :track
end
private
def find_conference
Conference.find params[:conference_id]
end
end

View File

@ -11,6 +11,12 @@ Rails.application.routes.draw do
end
end
namespace :api do
resources :conferences, only: [] do
resources :events, only: :index
end
end
namespace :management do
root to: 'home#index'