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:
@@ -131,7 +131,7 @@ class Comment < ApplicationRecord
|
||||
when "updated_at", "updated_at_desc"
|
||||
q = q.order("comments.updated_at DESC")
|
||||
else
|
||||
q = q.order("comments.id DESC")
|
||||
q = q.apply_default_order(params)
|
||||
end
|
||||
|
||||
q
|
||||
|
||||
Reference in New Issue
Block a user