Checks : pas de JSON en mode non-API

This commit is contained in:
Jérémy Lecour 2022-01-24 23:49:21 +01:00 committed by Jérémy Lecour
parent dfb2ba87c9
commit 4707a7da36

View file

@ -6,7 +6,7 @@ class ChecksController < ApplicationController
@checks = Check.all
end
# GET /checks/1 or /checks/1.json
# GET /checks/1
def show
end
@ -19,42 +19,31 @@ class ChecksController < ApplicationController
def edit
end
# POST /checks or /checks.json
# POST /checks
def create
@check = Check.new(check_params)
respond_to do |format|
if @check.save
format.html { redirect_to check_url(@check), notice: "Check was successfully created." }
format.json { render :show, status: :created, location: @check }
redirect_to check_url(@check), notice: "Check was successfully created."
else
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @check.errors, status: :unprocessable_entity }
render :new, status: :unprocessable_entity
end
end
end
# PATCH/PUT /checks/1 or /checks/1.json
# PATCH/PUT /checks/1
def update
respond_to do |format|
if @check.update(check_params)
format.html { redirect_to check_url(@check), notice: "Check was successfully updated." }
format.json { render :show, status: :ok, location: @check }
redirect_to check_url(@check), notice: "Check was successfully updated."
else
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @check.errors, status: :unprocessable_entity }
render :edit, status: :unprocessable_entity
end
end
end
# DELETE /checks/1 or /checks/1.json
# DELETE /checks/1
def destroy
@check.destroy
respond_to do |format|
format.html { redirect_to checks_url, notice: "Check was successfully destroyed." }
format.json { head :no_content }
end
redirect_to checks_url, notice: "Check was successfully destroyed."
end
private