feat: Sort articles based on views (#7599)
This commit is contained in:
@@ -65,6 +65,7 @@ class Article < ApplicationRecord
|
||||
scope :search_by_status, ->(status) { where(status: status) if status.present? }
|
||||
scope :order_by_updated_at, -> { reorder(updated_at: :desc) }
|
||||
scope :order_by_position, -> { reorder(position: :asc) }
|
||||
scope :order_by_views, -> { reorder(views: :desc) }
|
||||
|
||||
# TODO: if text search slows down https://www.postgresql.org/docs/current/textsearch-features.html#TEXTSEARCH-UPDATE-TRIGGERS
|
||||
pg_search_scope(
|
||||
|
||||
Reference in New Issue
Block a user