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:
@@ -187,7 +187,6 @@ class Dmail < ApplicationRecord
|
||||
|
||||
def search(params)
|
||||
q = super
|
||||
return q if params.blank?
|
||||
|
||||
if params[:title_matches].present?
|
||||
q = q.title_matches(params[:title_matches])
|
||||
@@ -225,7 +224,7 @@ class Dmail < ApplicationRecord
|
||||
q = q.unread
|
||||
end
|
||||
|
||||
q
|
||||
q.apply_default_order(params)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user