From b372312b83c6a2b93cb256eccf98d6a91aff4665 Mon Sep 17 00:00:00 2001 From: Pius Uzamere Date: Fri, 18 Dec 2009 12:53:18 -0500 Subject: [PATCH] RAND() --- app/models/question.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/question.rb b/app/models/question.rb index 6530783..323b071 100644 --- a/app/models/question.rb +++ b/app/models/question.rb @@ -33,8 +33,8 @@ class Question < ActiveRecord::Base def distinct_array_of_choice_ids(rank = 2, only_active = true) begin @the_choice_ids = Set.new - @the_choice_ids << choices.active.first(:order => 'RANDOM()', :select => 'id').id - @the_choice_ids << choices.active.last(:order => 'RANDOM()', :select => 'id').id + @the_choice_ids << choices.active.first(:order => 'RAND()', :select => 'id').id + @the_choice_ids << choices.active.last(:order => 'RAND()', :select => 'id').id end until @the_choice_ids.size == rank logger.info "set populated and looks like #{@the_choice_ids.inspect}" return @the_choice_ids.to_a -- libgit2 0.21.2