Commit b372312b83c6a2b93cb256eccf98d6a91aff4665
1 parent
5c4143a7
Exists in
master
and in
1 other branch
RAND()
Showing
1 changed file
with
2 additions
and
2 deletions
Show diff stats
app/models/question.rb
... | ... | @@ -33,8 +33,8 @@ class Question < ActiveRecord::Base |
33 | 33 | def distinct_array_of_choice_ids(rank = 2, only_active = true) |
34 | 34 | begin |
35 | 35 | @the_choice_ids = Set.new |
36 | - @the_choice_ids << choices.active.first(:order => 'RANDOM()', :select => 'id').id | |
37 | - @the_choice_ids << choices.active.last(:order => 'RANDOM()', :select => 'id').id | |
36 | + @the_choice_ids << choices.active.first(:order => 'RAND()', :select => 'id').id | |
37 | + @the_choice_ids << choices.active.last(:order => 'RAND()', :select => 'id').id | |
38 | 38 | end until @the_choice_ids.size == rank |
39 | 39 | logger.info "set populated and looks like #{@the_choice_ids.inspect}" |
40 | 40 | return @the_choice_ids.to_a | ... | ... |