You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: products_controller.rb
    path of file: ./repos/rails-practice-code/chapter_3/shop3.3/app/controllers
    
    the code of the file until where you have to start completion: class ProductsController < ApplicationController
  skip_before_action :authenticate_user!, only: [:index]

  before_action :set_product, only: [:show, :edit, :update, :destroy]

  # GET /products
  # GE
    
  def update
    respond_to do |format|
      if @product.update(product_params)
        format.html { redirect_to @product, notice: 'Product was successfully updated.' }
        format.json
      else
        format.html { render :edit }
        format.json { render json: @product.errors.full_messages.join(', '), status: :error }
      end
    end