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:
@@ -6,7 +6,6 @@ class NoteVersion < ApplicationRecord
|
||||
|
||||
def self.search(params)
|
||||
q = super
|
||||
return q if params.blank?
|
||||
|
||||
if params[:updater_id]
|
||||
q = q.where(updater_id: params[:updater_id].split(",").map(&:to_i))
|
||||
@@ -20,7 +19,7 @@ class NoteVersion < ApplicationRecord
|
||||
q = q.where(note_id: params[:note_id].split(",").map(&:to_i))
|
||||
end
|
||||
|
||||
q
|
||||
q.apply_default_order(params)
|
||||
end
|
||||
|
||||
def initialize_updater
|
||||
|
||||
Reference in New Issue
Block a user