class Answer

Public Instance Methods

text_answer() click to toggle source
# File lib/od/surveys/generators/templates/models/answer.rb, line 12
def text_answer
  return justification if question.text?

  array_answers = choices.order(:id).map do |c|
    placeholder = question.placeholder.blank? ? ', ' : ", #{question.placeholder} "
    if c.justifiable
      "#{c.value}#{placeholder}#{justification.capitalize}"
    else
      c.value
    end
  end
  array_answers.join(', ')
end