diff --git a/app/models/question.rb b/app/models/question.rb index 8d4f9d5..4510d3e 100644 --- a/app/models/question.rb +++ b/app/models/question.rb @@ -24,16 +24,18 @@ class Question < ActiveRecord::Base def picked_prompt pc = self.prompts_count < 1 ? 2 : self.prompts_count begin - return p = prompts.find(rand(pc-1) + prompts.first.id) - end until p.active? + @p = prompts.find(rand(pc-1) + prompts.first.id) + end until @p.active? + return @p end def picked_prompt_id pc = self.prompts_count < 1 ? 2 : self.prompts_count begin - return i = rand(pc-1) + prompts.first.id #try caching this first prompt value at some point - end until prompts.find(i).active? + @i = rand(pc-1) + prompts.first.id #try caching this first prompt value at some point + end until prompts.find(@i).active? + return @i end def left_choice_text(prompt = nil) -- libgit2 0.21.2