Class: ScavengerHunt::SurveyQuestion

Inherits:
ApplicationRecord show all
Defined in:
lib/scavenger_hunt/app/models/scavenger_hunt/survey_question.rb

Instance Method Summary collapse

Methods inherited from ApplicationRecord

hook, position_scope

Instance Method Details

#answer(player, answer) ⇒ Object



4
5
6
7
# File 'lib/scavenger_hunt/app/models/scavenger_hunt/survey_question.rb', line 4

def answer(player, answer)
  return unless player
  player.survey_answers.find_or_initialize_by(survey_question_id: id).update_attributes!(answer: answer)
end