class ActiveStorage::Attached::One

def detach

Deletes the attachment without purging it, leaving its blob in place.
def detach
  if attached?
    attachment.delete
    write_attachment nil
  end
end