Rooms belong to venue

This commit is contained in:
Stella Rouzi 2015-11-07 11:43:36 +02:00 committed by Henne Vogelsang
parent feabbfbc99
commit f840f2b3f0
31 changed files with 221 additions and 166 deletions

View file

@ -5,8 +5,12 @@ module Api
respond_to :json
def index
@conference ? (rooms = @conference.rooms) : (rooms = Room.all)
if params[:conference_id].blank?
rooms = Room.all
else
conference = Conference.find_by_guid(params[:conference_id])
rooms = conference.venue.rooms if conference.venue
end
respond_with rooms
end
end