module Approval module RespondForm class Cancel < Base private def prepare ::Approval::Request.transaction do request.lock! request.assign_attributes(state: :cancelled, cancelled_at: Time.current, respond_user_id: user.id) request.comments.new(user_id: user.id, content: reason) yield(request) end end end end end