Update record with CSV
Regarding the first task, you could save a couple of queries by modifying the code to look like this:

# ....

CSV.foreach('public/update/item_categories.csv', headers: true) do |row|
  row_hash = row.to_hash
  category = categories[row_hash['category'].to_i]

  item = Item.where(id: row_hash['id'])
  item.update_attributes!(category: category) unless item.nil?
end

# ....


You can retrieve the item once and perform update_attributes! without save!. update_attributes! saves the changes to the db using save! internally. Here's the source code (update_attributes! it's an alias for update!):

def update!(attributes)
  with_transaction_returning_status do
    assign_attributes(attributes)
    save!
  end
end


Regarding the second task, since you want to raise an exception in case of invalid record, you have to save each record individually but you can save some queries by finding records in batches. The code could look like this:

Item.find_each(category: nil) do |item|
  item.update_attributes!(category: 'misc')
end