-
Notifications
You must be signed in to change notification settings - Fork 2
Console catalogue sorting
Petr Marek edited this page Oct 14, 2021
·
1 revision
Sort arrows are added automatically for all catalogue attributes when appropriate scopes exist on the model class. Scopes should be named sort_by_CATALOGUE_ATTRIBUTE_asc
and sort_by_CATALOGUE_ATTRIBUTE_desc
.
To add sorting by :use_count
(when using attribute(:use_count)
in a catalogue), add the following scopes to your model:
scope :sort_by_use_count_asc, -> { order(use_count: :asc) }
scope :sort_by_use_count_desc, -> { order(use_count: :desc) }