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:
@@ -45,8 +45,6 @@ class PostAppeal < ApplicationRecord
|
||||
|
||||
def search(params)
|
||||
q = super
|
||||
q = q.order("post_appeals.id desc")
|
||||
return q if params.blank?
|
||||
|
||||
if params[:reason_matches].present?
|
||||
q = q.reason_matches(params[:reason_matches])
|
||||
@@ -74,7 +72,7 @@ class PostAppeal < ApplicationRecord
|
||||
q = q.unresolved
|
||||
end
|
||||
|
||||
q
|
||||
q.apply_default_order(params)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user