Introduce a rudimentary JSON export of events
This commit is contained in:
parent
a5b1515081
commit
5ecafd9573
|
@ -0,0 +1,2 @@
|
||||||
|
class Api::ApplicationController < ::ApplicationController
|
||||||
|
end
|
|
@ -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
|
|
@ -11,6 +11,12 @@ Rails.application.routes.draw do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
namespace :api do
|
||||||
|
resources :conferences, only: [] do
|
||||||
|
resources :events, only: :index
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
namespace :management do
|
namespace :management do
|
||||||
root to: 'home#index'
|
root to: 'home#index'
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue