2.5 - Supprimer une creature

pull/1/head
Karim Bogtob 2 years ago
parent 3f4df1c8e5
commit 180c1735d0

@ -28,6 +28,12 @@ class CreaturesController < ApplicationController
render json: {}, status: 404
end
def destroy
@creature = Creature.find(params[:id])
@creature.destroy!
head :no_content
end
private
def create_or_update_params
params.require(:creature).permit(:name)

@ -7,6 +7,7 @@ Rails.application.routes.draw do
get '/creatures/:id', to: 'creatures#show'
post '/creatures', to: 'creatures#create'
put '/creatures/:id', to: 'creatures#update'
delete '/creatures/:id', to: 'creatures#destroy'
# Defines the root path route ("/")
root 'home#welcome'

Loading…
Cancel
Save