3.2 Lister les combats

pull/1/head
Karim Bogtob 2 years ago
parent cca68f8dd7
commit c27505b453

@ -5,6 +5,11 @@ class CombatsController < ApplicationController
winner: { only: CreaturesController::SHOWABLE_ATTRIBUTES },
}
def index
@combats = Combat.all
render json: @combats.as_json(include: COMBATS_RENDER_CONFIG)
end
def create
left_fighter = Creature.find(params[:left_fighter_id])
right_fighter = Creature.find(params[:right_fighter_id])

@ -10,6 +10,7 @@ Rails.application.routes.draw do
delete '/creatures/:id', to: 'creatures#destroy'
# Combats
get '/combats', to: 'combats#index'
post '/combats', to: 'combats#create'
# Defines the root path route ("/")

Loading…
Cancel
Save