ブール値を返すためのより慣用的な方法はあり#survey_completed?
ますfalse
か?
これは私のコードが現在どのように見えるかです:
def survey_completed?
self.survey_completed_at ? true: false
end
def survey_completed_at
# Seeing as the survey is submitted all or nothing, the time the last response is persisted
# is when the survey is completed
last_response = self.responses.last
if last_response
last_response.created_at
end
end