app/models/question.rb
# Set a unique filename to curb collisions e.g. on ODK,
# maintaining the extension e.g. ".mp3".
Set a unique filename to curb collisions e.g. on ODK,
maintaining the extension e.g.
Set a unique filename to curb collisions e . g . on ODK maintaining the extension e . g .
def generate_media_prompt_filename
    return nil unless media_prompt?
    extension = File.extname(media_prompt.filename.to_s)
    unique_id = id.presence || "new_#{SecureRandom.uuid}" 
    media_prompt.assign_attributes(filename: "#{unique_id}_media_prompt#{extension}")
  end
def generate_media_prompt_filename return nil unless media_prompt? extension = File . extname ( media_prompt . filename . to_s ) unique_id = id . presence || "new_#{SecureRandom.uuid}" media_prompt . assign_attributes ( filename : "#{unique_id}_media_prompt#{extension}" ) end
Set a unique filename to curb collisions e.g.
Set a unique filename to curb collisions e . g .
# Fallback if question is not yet saved.