From c2111bd89637ba0c148c5a9bd0b7a6bcb9689c6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diane=20Delall=C3=A9e?= Date: Wed, 26 May 2021 11:53:53 +0200 Subject: [PATCH] Update chapter03-presenting-users.adoc The update function was missing in the example --- rails6/fr/chapter03-presenting-users.adoc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/rails6/fr/chapter03-presenting-users.adoc b/rails6/fr/chapter03-presenting-users.adoc index 86da07a..78ca81f 100644 --- a/rails6/fr/chapter03-presenting-users.adoc +++ b/rails6/fr/chapter03-presenting-users.adoc @@ -576,6 +576,15 @@ class Api::V1::UsersController < ApplicationController end # ... + + def update + if @user.update(user_params) + render json: @user + else + render json: @user.errors, status: :unprocessable_entity + end + end + def create @user = User.new(user_params)