Class: Effective::BallotResponse

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/effective/ballot_response.rb

Instance Method Summary collapse

Instance Method Details

#category_partialObject



87
88
89
# File 'app/models/effective/ballot_response.rb', line 87

def category_partial
  poll_question&.category_partial
end

#responseObject



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'app/models/effective/ballot_response.rb', line 70

def response
  return nil unless poll_question.present?

  return date if poll_question.date?
  return email if poll_question.email?
  return number if poll_question.number?
  return long_answer if poll_question.long_answer?
  return short_answer if poll_question.short_answer?
  return upload_file if poll_question.upload_file?

  return poll_question_options.first if poll_question.choose_one?
  return poll_question_options.first if poll_question.select_up_to_1?
  return poll_question_options if poll_question.poll_question_option?

  raise('unknown response for unexpected poll question category')
end

#to_sObject



66
67
68
# File 'app/models/effective/ballot_response.rb', line 66

def to_s
  model_name.human
end