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: forum_post_response.rb
    path of file: ./repos/coursemology2/app/models/course/assessment/question
    
    the code of the file until where you have to start completion: # frozen_string_literal: true
class Course::Assessment::Question::ForumPostResponse < ApplicationRecord
  acts_as :question, class_name: Course::Assessment::Qu
    
  def attempt(submission, last_attempt = nil)
    answer =
      Course::Assessment::Answer::ForumPostResponse.new(submission: submission, question: question)

    if last_attempt
      answer.answer_text = last_attempt.answer_text
      answer.post_packs = last_attempt.post_packs.map(&:dup) if last_attempt.post_packs.any?
    end