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: categories_controller.rb
    path of file: ./repos/SalorHospitality/salor-hospitality/app/controllers
    
    the code of the file until where you have to start completion: # coding: UTF-8

# Copyright (c) 2012 Red (E) Tools Ltd.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subje
    
  def update
    @category = get_model
    redirect_to categories_path and return unless @category
    
    params[:category][:icon] = 'custom' if (params[:category][:images_attributes] and params[:category][:images_attributes]['0'][:file_data])
    permitted = params.require(:category).permit :name,
      :preparation_user_id,
      :vendor_printer_id,
      :separate_print,
      :icon,
      :color,
    :images_attributes => [
      :file_data
    ]
    
    if @category.update_attributes permitted
      #@category.images.update_all :company_id => @category.company_id
      flash[:notice] = I18n.t("categories.create.success")
      redirect_to categories_path
    else
      @taxes = @current_vendor.taxes.existing
      @users = @current_vendor.users.existing.active.where('role_weight > 0')
      @printers = @current_vendor.vendor_printers.existing
      render :new
    end