* hiding 'id' field in participants because it's not used. but I wish the 'client_id' field is called 'id' and haven't figured out how to fix it via rabl
This commit is contained in:
parent
8837b29814
commit
5e2bac6e95
|
|
@ -69,7 +69,7 @@ class ApiMusicSessionsController < ApplicationController
|
|||
end
|
||||
|
||||
def participant_show
|
||||
@connection = Connection.find(params[:id])
|
||||
@connection = Connection.find_by_client_id(params[:id])
|
||||
end
|
||||
|
||||
def participant_create
|
||||
|
|
@ -100,7 +100,7 @@ class ApiMusicSessionsController < ApplicationController
|
|||
def participant_delete
|
||||
|
||||
ConnectionManager.active_record_transaction do |connection_manager|
|
||||
@connection = Connection.find_by_client_id(params[:client_id])
|
||||
@connection = Connection.find_by_client_id(params[:id])
|
||||
|
||||
if @connection.nil?
|
||||
raise JamArgumentError, "no client found with specified client_id #{id}"
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
object @connection
|
||||
|
||||
attributes :id, :ip_address, :client_id
|
||||
attributes :ip_address, :client_id => :id
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
object @connection
|
||||
|
||||
attributes :ip_address, :client_id
|
||||
|
|
@ -4,5 +4,5 @@ attributes :id, :description
|
|||
|
||||
child(:connections => :participants) {
|
||||
collection @music_sessions, :object_root => false
|
||||
attributes :id, :ip_address, :client_id
|
||||
attributes :ip_address, :client_id
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ SampleApp::Application.routes.draw do
|
|||
scope '/api' do
|
||||
# music sessions
|
||||
match '/sessions/:id/participants' => 'api_music_sessions#participant_create', :via => :post
|
||||
match '/participants/:client_id' => 'api_music_sessions#participant_show', :via => :get, :as => 'api_session_participant_detail'
|
||||
match '/participants/:client_id' => 'api_music_sessions#participant_delete', :via => :delete
|
||||
match '/participants/:id' => 'api_music_sessions#participant_show', :via => :get, :as => 'api_session_participant_detail'
|
||||
match '/participants/:id' => 'api_music_sessions#participant_delete', :via => :delete
|
||||
match '/sessions/:id' => 'api_music_sessions#show', :via => :get, :as => 'api_session_detail'
|
||||
match '/sessions/:id' => 'api_music_sessions#delete', :via => :delete
|
||||
match '/sessions' => 'api_music_sessions#index', :via => :get
|
||||
|
|
|
|||
Loading…
Reference in New Issue