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: theme_controller.rb
    path of file: ./repos/retrospring/app/controllers/settings
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

class Settings::ThemeController < ApplicationController
  include ThemeHelper

  bef
    
  def edit; end

  def update
    if current_user.theme.nil?
      current_user.theme = Theme.new theme_attributes
      current_user.theme.user_id = current_user.id

      if current_user.theme.save
        flash[:success] = t(".success")
      else
        flash[:error] = t(".error", errors: current_user.theme.errors.messages.flatten.join(" "))
      end
    elsif current_user.theme.update(theme_attributes)
      flash[:success] = t(".success")
    else
      flash[:error] = t(".error", errors: current_user.theme.errors.messages.flatten.join(" "))
    end