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: has_attributes.rb
    path of file: ./repos/open-build-service/src/api/app/models/concerns
    
    the code of the file until where you have to start completion: # a model that has attributes - e.g. a project and a package
module HasAttributes
  extend ActiveSupport::Concern

  class AttributeSaveError < APIError
  end

  def write_attributes
    return unless CONFIG['global_write_through']

    project_name = is_a?(Project) ? name : project.name
    if is_a?(Package)
      Backend::Api::Sources::Package.write_attributes(project_name, name, User.session!.login, render_at
    
  def find_attribute(namespace, name, binary = nil)
    raise AttributeFindError, 'Namespace must be given' unless namespace
    raise AttributeFindError, 'Name must be given' unless name
    raise AttributeFindError, 'binary packages are not allowed in project attributes' if is_a?(Project) && binary

    query = attribs.joins(attrib_type: :attrib_namespace)
    query = query.where(attrib_types: { name: name },
                        binary: binary,
                        attrib_namespaces: { name: namespace })
    query.readonly(false).first
  end