remove all mappings from a synapse on destroy in controller. Haven't added stuff to remove mappings to controller
This commit is contained in:
parent
c739f58b4b
commit
01fe14dbd1
1 changed files with 9 additions and 4 deletions
|
@ -115,12 +115,17 @@ class SynapsesController < ApplicationController
|
||||||
respond_with(@user, location: synapse_url(@synapse)) do |format|
|
respond_with(@user, location: synapse_url(@synapse)) do |format|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# DELETE synapses/:id
|
# DELETE synapses/:id
|
||||||
def destroy
|
def destroy
|
||||||
@current = current_user
|
@current = current_user
|
||||||
@synapse = Synapse.find(params[:id]).authorize_to_edit(@current)
|
@synapse = Synapse.find(params[:id]).authorize_to_edit(@current)
|
||||||
|
|
||||||
@synapse.delete if @synapse
|
@synapse.mappings.each do |m|
|
||||||
|
m.delete
|
||||||
|
end
|
||||||
|
|
||||||
|
@synapse.delete if @synapse
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue