class ActiveStorage::Attached::Changes::DetachOne

:nodoc:

def detach

def detach
  if attachment.present?
    attachment.delete
    reset
  end
end

def initialize(name, record, attachment)

def initialize(name, record, attachment)
  @name, @record, @attachment = name, record, attachment
end

def reset

def reset
  record.attachment_changes.delete(name)
  record.public_send("#{name}_attachment=", nil)
end