From 55cfc8ff60cbaa0fb28f00b143032ae459f8b893 Mon Sep 17 00:00:00 2001 From: Nishanth Vijayan Date: Sun, 13 Mar 2016 21:19:58 +0530 Subject: [PATCH] Fix API endpoints conferences/id/rooms/ & tracks/ issue #874 --- app/controllers/api/v1/rooms_controller.rb | 3 +-- app/controllers/api/v1/tracks_controller.rb | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/controllers/api/v1/rooms_controller.rb b/app/controllers/api/v1/rooms_controller.rb index 7ffd67c8..fb25e08b 100644 --- a/app/controllers/api/v1/rooms_controller.rb +++ b/app/controllers/api/v1/rooms_controller.rb @@ -8,8 +8,7 @@ module Api if params[:conference_id].blank? rooms = Room.all else - conference = Conference.find_by_guid(params[:conference_id]) - rooms = conference.venue.rooms if conference.venue + @conference.venue ? (rooms = @conference.venue.rooms) : (rooms = []) end respond_with rooms end diff --git a/app/controllers/api/v1/tracks_controller.rb b/app/controllers/api/v1/tracks_controller.rb index f477cc0c..5ddcafd1 100644 --- a/app/controllers/api/v1/tracks_controller.rb +++ b/app/controllers/api/v1/tracks_controller.rb @@ -5,7 +5,7 @@ module Api respond_to :json def index - @conference ? (tracks = @conference.tracks) : (tracks = Track.all) + @conference ? (tracks = @conference.program.tracks) : (tracks = Track.all) respond_with tracks end