#1938: Add order:random using order by random()
This commit is contained in:
@@ -339,6 +339,9 @@ class PostQueryBuilder
|
|||||||
when "rank"
|
when "rank"
|
||||||
relation = relation.order("log(3, posts.score) + (extract(epoch from posts.created_at) - extract(epoch from timestamp '2005-05-24')) / 45000 DESC")
|
relation = relation.order("log(3, posts.score) + (extract(epoch from posts.created_at) - extract(epoch from timestamp '2005-05-24')) / 45000 DESC")
|
||||||
|
|
||||||
|
when "random"
|
||||||
|
relation = relation.order("random()")
|
||||||
|
|
||||||
else
|
else
|
||||||
relation = relation.order("posts.id DESC")
|
relation = relation.order("posts.id DESC")
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user