36 lines
884 B
Ruby
36 lines
884 B
Ruby
class ApiRsvpSlotsController < ApiController
|
|
|
|
# before_filter :auth_user
|
|
|
|
respond_to :json
|
|
|
|
def index
|
|
|
|
if params[:session_id].blank?
|
|
render :json => {:message => "Session ID is required"}, :status => 400
|
|
|
|
else
|
|
music_session = MusicSession.find(params[:session_id])
|
|
|
|
# retrieve all slots for this session
|
|
if params[:open_only]
|
|
@rsvp_slots = music_session.open_slots
|
|
else
|
|
@rsvp_slots = RsvpSlot.index(music_session)
|
|
end
|
|
|
|
respond_with @rsvp_slots, responder: ApiResponder, :status => 200
|
|
|
|
end
|
|
|
|
end
|
|
|
|
# def create
|
|
# if params[:id].blank? || params[:session_id].blank?
|
|
# render :json => {:message => "Session ID is required."}, :status => 400
|
|
# else
|
|
# @rsvp = RsvpRequest.create(params, current_user)
|
|
# respond_with @rsvp, responder: ApiResponder, :status => 201
|
|
# end
|
|
# end
|
|
end |