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: user_address_book.rb
    path of file: ./repos/solidus/core/app/models/concerns/spree
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

module Spree
  module UserAddressBook
    extend ActiveSupport::Concern

    included do
      has_many :user_addresses, -> { active }, foreign_key: "user_id", class_name: "Spree::UserAddress" do
        def find_first_by_address_values(address_attrs)
          detect { |ua| ua.address == Spree::Address.new(address_attrs) }
        end

        def mark_default(user_address, addr
    
        def mark_default(user_address, address_type: :shipping)
          column_for_default = address_type == :shipping ? :default : :default_billing
          ActiveRecord::Base.transaction do
            (self - [user_address]).each do |address| # update_all would be nice, but it bypasses ActiveRecord callbacks
              if address.persisted?
                address.update!(column_for_default => false)
              else
                address.write_attribute(column_for_default, false)
              end
            end

            if user_address.persisted?
              user_address.update!(column_for_default => true, archived: false)
            else
              user_address.write_attribute(column_for_default, true)
            end