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: cart_items_controller.rb
    path of file: ./repos/trado/app/controllers
    
    the code of the file until where you have to start completion: class CartItemsController < ApplicationController
  include CartBuilder
	skip_before_action :authenticate_user!

	def create
		set_sku
		set_create_quantity
		if @sku.valid_stock?(@quantity)
			set_and_adjust_cart_item(params[:cart_item][:quantity])
            render json: { html: render_to_string(partial: theme_presenter.page_template_path('carts/popup')), cart_quantity: current_cart.cart_items.sum('quantity') }, status: 200
		else
      render json: { html: render_to_string(partial: theme_presenter.page_template_path("carts/cart_items/validate/modal"), l
    
	def update
		set_cart_item
		set_update_quantity
		set_accessory
		if @cart_item.sku.valid_stock?(@quantity)
			set_and_adjust_cart_item(params[:cart_item][:quantity].to_i - @cart_item.quantity)
      set_cart_totals
      render json: { 
        popup: render_to_string(partial: theme_presenter.page_template_path('carts/popup')),
        cart: render_to_string(partial: theme_presenter.page_template_path('carts/cart')),
        cart_quantity: current_cart.cart_items.sum('quantity'),
        subtotal: Store::Price.new(price: @cart_totals[:subtotal]).single,
        tax: Store::Price.new(price: @cart_totals[:tax]).single,
        total: Store::Price.new(price: @cart_totals[:total]).single,
        empty_cart: current_cart.cart_items.empty? ? true : false
      }, status: 200
		else
      render json: { html: render_to_string(partial: theme_presenter.page_template_path("carts/cart_items/validate/modal"), locals: { sku: @cart_item.sku }) }, status: 422
		end