Created
July 11, 2011 14:07
-
-
Save janjiss/1075915 to your computer and use it in GitHub Desktop.
Does not set to true even if question count is more than progress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Tracker < ActiveRecord::Base | |
attr_accessible :survey_id, :respondent_id, :progress, :completed | |
belongs_to :survey | |
after_save :set_completed? | |
#set tracker.completed to true if all questions are answered | |
def set_completed? | |
if progress >= survey.questions.count | |
completed = true | |
end | |
end | |
end | |
#Does not set to true even if question count is more than progress |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment