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|
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# DELETE synapses/:id
|
||||
def destroy
|
||||
@current = current_user
|
||||
@synapse = Synapse.find(params[:id]).authorize_to_edit(@current)
|
||||
|
||||
@synapse.delete if @synapse
|
||||
@current = current_user
|
||||
@synapse = Synapse.find(params[:id]).authorize_to_edit(@current)
|
||||
|
||||
@synapse.mappings.each do |m|
|
||||
m.delete
|
||||
end
|
||||
|
||||
@synapse.delete if @synapse
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue