app/models/user.rb
#  Returns last unanswered questionnaire or nil if none exists

Returns last unanswered questionnaire or nil if none exists
Returns last unanswered questionnaire or nil if none exists
def last_unanswered_questionnaire
    last_unanswered = unanswered_questionnaires.last rescue nil
    the_very_last = Questionnaire.by_language_published(I18n.locale).last
    last_unanswered == the_very_last ? last_unanswered : nil
  end
def last_unanswered_questionnaire last_unanswered = unanswered_questionnaires . last rescue nil the_very_last = Questionnaire . by_language_published ( I18n . locale ) . last last_unanswered == the_very_last ? last_unanswered : nil end
Returns last unanswered questionnaire or nil if none exists
Returns last unanswered questionnaire or nil if none exists