diff --git a/.gems b/.gems index a7bca95..a5c57bf 100644 --- a/.gems +++ b/.gems @@ -8,4 +8,3 @@ justinfrench-formtastic --version '0.2.2' --source gems.github.com thoughtbot-clearance --version '0.8.2' --source gems.github.com josevalim-inherited_resources --version '0.9.1' --source gems.github.com activemerchant --version 1.4.2' - diff --git a/app/models/question.rb b/app/models/question.rb index 4510d3e..3ad8f8b 100644 --- a/app/models/question.rb +++ b/app/models/question.rb @@ -22,20 +22,14 @@ class Question < ActiveRecord::Base end def picked_prompt - pc = self.prompts_count < 1 ? 2 : self.prompts_count begin - @p = prompts.find(rand(pc-1) + prompts.first.id) + @p = prompts.first(:order => 'RANDOM()') end until @p.active? return @p end - def picked_prompt_id - pc = self.prompts_count < 1 ? 2 : self.prompts_count - begin - @i = rand(pc-1) + prompts.first.id #try caching this first prompt value at some point - end until prompts.find(@i).active? - return @i + picked_prompt.id end def left_choice_text(prompt = nil) -- libgit2 0.21.2