fix(manager): don't break DS by sorting Dossier by created_at
This commit is contained in:
parent
294725ae67
commit
e60c92957d
1 changed files with 10 additions and 1 deletions
|
@ -5,7 +5,7 @@ module Manager
|
||||||
|
|
||||||
def default_params
|
def default_params
|
||||||
request.query_parameters[resource_name] ||= {
|
request.query_parameters[resource_name] ||= {
|
||||||
order: "created_at",
|
order: "id",
|
||||||
direction: "desc"
|
direction: "desc"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -24,6 +24,15 @@ module Manager
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def sorting_attribute
|
||||||
|
attribute = super
|
||||||
|
|
||||||
|
# do not sort by non-indexed created_at. This require a full table scan, locking every other transactions.
|
||||||
|
return :id if attribute.to_sym == :created_at
|
||||||
|
|
||||||
|
attribute
|
||||||
|
end
|
||||||
|
|
||||||
# private method called by rails fwk
|
# private method called by rails fwk
|
||||||
# see https://github.com/roidrage/lograge
|
# see https://github.com/roidrage/lograge
|
||||||
def append_info_to_payload(payload)
|
def append_info_to_payload(payload)
|
||||||
|
|
Loading…
Reference in a new issue