From 08b60c1f4267da3c36872aada12d8ef0db401b55 Mon Sep 17 00:00:00 2001 From: Pius Uzamere Date: Thu, 3 Dec 2009 21:31:32 -0500 Subject: [PATCH] save before computing score --- app/models/visitor.rb | 1 + 1 file changed, 1 insertion(+), 0 deletions(-) diff --git a/app/models/visitor.rb b/app/models/visitor.rb index 51a6975..87ec363 100644 --- a/app/models/visitor.rb +++ b/app/models/visitor.rb @@ -16,6 +16,7 @@ class Visitor < ActiveRecord::Base choice = prompt.choices[ordinality] #we need to guarantee that the choices are in the right order (by position) prompt_vote = votes.create!(:voteable => prompt) choice_vote = votes.create!(:voteable => choice) + choice.save! choice.score = choice.compute_score choice.save! end -- libgit2 0.21.2