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