app/models/media/object.rb
# build a more complex filename if is nested in repeat groups
build a more complex filename if is nested in repeat groups
build a more complex filename if is nested in repeat groups
def build_filename(filename, item)
      repeat_groups = []
      answer = item.record.answer
      answer_group = nil
      answer_group = next_repeat_group_up(answer.parent_id) if answer.parent_id
      if answer_group.present?
        repeat_groups = respect_ancestors(answer_group, repeat_groups)
        filename += "-#{repeat_groups.pop}" until repeat_groups.empty?
      end
      filename += "-#{answer.question.code}"
      filename += File.extname(item.filename.to_s)
      filename.gsub(/[^0-9A-Za-z.\-]/, "_")
    end
def build_filename ( filename , item ) repeat_groups = [ ] answer = item . record . answer answer_group = nil answer_group = next_repeat_group_up ( answer . parent_id ) if answer . parent_id if answer_group . present? repeat_groups = respect_ancestors ( answer_group , repeat_groups ) filename += "-#{repeat_groups.pop}" until repeat_groups . empty? end filename += "-#{answer.question.code}" filename += File . extname ( item . filename . to_s ) filename . gsub ( / [^0-9A-Za-z. \- ] / , "_" ) end
build a more complex filename if is nested in repeat groups
build a more complex filename if is nested in repeat groups
filename
<not_specific>
item
<not_specific>