def admin_update
      return if !user_is_allowed('variants', 'edit')
      
      resp = Caboose::StdClass.new({'attributes' => {}})
      v = Variant.find(params[:id])    
      
      save = true    
      params.each do |name,value|
        case name        
          when 'alternate_id'
            v.alternate_id = value
          when 'sku'
            v.sku = value
          when 'barcode'
            v.barcode = value
          when 'price'
            v.price = value
          when 'quantity_in_stock'
            v.quantity_in_stock = value
          when 'ignore_quantity'
            v.ignore_quantity = value
          when 'allow_backorder'
            v.allow_backorder = value
          when 'status'
            v.status = value
          when 'weight'
            v.weight = value
          when 'length'
            v.length = value
          when 'width'
            v.width = value
          when 'height'
            v.height = value
          when 'option1'
            v.option1 = value
          when 'option2'
            v.option2 = value
          when 'option3'
            v.option3 = value
          when 'requires_shipping'
            v.requires_shipping = value
          when 'taxable'
            v.taxable = value
        end
      end
      resp.success = save && v.save
      render :json => resp
    end
def admin_update
      return if !user_is_allowed('variants', 'edit')
      
      resp = Caboose::StdClass.new({'attributes' => {}})
      v = Variant.find(params[:id])    
      
      save = true    
      params.each do |name,value|
        case name        
          when 'alternate_id'
            v.alternate_id = value
          when 'sku'
            v.sku = value
          when 'barcode'
            v.barcode = value
          when 'price'
            v.price = value
          when 'quantity_in_stock'
            v.quantity_in_stock = value
          when 'ignore_quantity'
            v.ignore_quantity = value
          when 'allow_backorder'
            v.allow_backorder = value
          when 'status'
            v.status = value
          when 'weight'
            v.weight = value
          when 'length'
            v.length = value
          when 'width'
            v.width = value
          when 'height'
            v.height = value
          when 'option1'
            v.option1 = value
          when 'option2'
            v.option2 = value
          when 'option3'
            v.option3 = value
          when 'requires_shipping'
            v.requires_shipping = value
          when 'taxable'
            v.taxable = value
        end
      end
      resp.success = save && v.save
      render :json => resp
    end
PUT /admin/variants/:id