From 4707a7da3691d6af6f86437ece25b89c40e401dc Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Mon, 24 Jan 2022 23:49:21 +0100 Subject: [PATCH] Checks : pas de JSON en mode non-API --- app/controllers/checks_controller.rb | 29 +++++++++------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/app/controllers/checks_controller.rb b/app/controllers/checks_controller.rb index 9bd4f1d..62b1f0d 100644 --- a/app/controllers/checks_controller.rb +++ b/app/controllers/checks_controller.rb @@ -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