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:
@@ -53,7 +53,6 @@ class ModAction < ApplicationRecord
|
||||
|
||||
def self.search(params)
|
||||
q = super
|
||||
return q if params.blank?
|
||||
|
||||
if params[:creator_id].present?
|
||||
q = q.where("creator_id = ?", params[:creator_id].to_i)
|
||||
@@ -67,7 +66,7 @@ class ModAction < ApplicationRecord
|
||||
q = q.attribute_matches(:category, params[:category])
|
||||
end
|
||||
|
||||
q
|
||||
q.apply_default_order(params)
|
||||
end
|
||||
|
||||
def category_id
|
||||
|
||||
Reference in New Issue
Block a user