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)