class UsersController < ApplicationController
  before_action :set_user, only: [:show, :edit, :update]

  def new
    @titel = "Sign up"
    @user = User.new    
  end

  def show
    @titel = @user.name
  end  
  
  def create
    @user = User.new(user_params)
    if @user.save
      sign_in @user
      flash[:success] = "Welcome to Mini Blog!"
      # succès d'enregistrement et redirection users/:id.
      redirect_to @user
    else
      @user.password = nil
      @user.password_confirmation = nil
      render 'new'
    end  
  end

  def edit
    @titel = "Edit user"
  end

  def update
    if @user.updat_attributes(params[:user])
      flash[:success] = "Update profile #{@user.name}."
      redirect_to @user
    else
      render 'edit'
    end
  end
  
  private

  def set_user
    @user = User.find(params[:id])
  end

  def user_params
    params.require(:user).permit(:name, :email, :password, :password_confirmation)
  end  
end

class UsersController < ApplicationController
  before_action :set_user, only: [:show, :edit, :update]

  def new
    @titel = "Sign up"
    @user = User.new    
  end

  def show
    @titel = @user.name
  end  
  
  def create
    @user = User.new(user_params)
    if @user.save
      sign_in @user
      flash[:success] = "Welcome to Mini Blog!"
      # succès d'enregistrement et redirection users/:id.
      redirect_to @user
    else
      @user.password = nil
      @user.password_confirmation = nil
      render 'new'
    end  
  end

  def edit
    @titel = "Edit user"
  end

  def update
    if @user.update_attributes(params[:user])
      flash[:success] = "Update profile #{@user.name}."
      redirect_to @user
    else
      render 'edit'
    end
  end
  
  private

  def set_user
    @user = User.find(params[:id])
  end

  def user_params
    params.require(:user).permit(:name, :email, :password, :password_confirmation)
  end  
end

Add action update and edit user
Add action update and edit user
