Move all order logic to models
- Have a default order for each model -- The overall default is ID DESC - Allow for custom orderings -- When comma-separated IDs are used
This commit is contained in:
@@ -515,6 +515,11 @@ class PostQueryBuilder
|
||||
when "rank"
|
||||
relation = relation.order("log(3, posts.score) + (extract(epoch from posts.created_at) - extract(epoch from timestamp '2005-05-24')) / 35000 DESC")
|
||||
|
||||
when "custom"
|
||||
if q[:post_id].present? && q[:post_id][0] == :in
|
||||
relation = relation.find_ordered(q[:post_id][1])
|
||||
end
|
||||
|
||||
else
|
||||
relation = relation.order("posts.id DESC")
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user