From 8ee0acae85e8d40c5652fd3791848c26ee268b5a Mon Sep 17 00:00:00 2001 From: jasder Date: Fri, 14 May 2021 16:39:32 +0800 Subject: [PATCH] set default desc sort for faqs api --- app/controllers/admins/faqs_controller.rb | 2 +- app/controllers/helps/faqs_controller.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/admins/faqs_controller.rb b/app/controllers/admins/faqs_controller.rb index 08dc69a79..fc00f847c 100644 --- a/app/controllers/admins/faqs_controller.rb +++ b/app/controllers/admins/faqs_controller.rb @@ -2,7 +2,7 @@ class Admins::FaqsController < Admins::BaseController before_action :find_faq, only: [:edit,:update, :destroy] def index - sort_by = params[:sort_by] ||= 'created_at' + sort_by = params[:sort_by] ||= 'updated_at' sort_direction = params[:sort_direction] ||= 'desc' keyword = params[:keyword].to_s.strip diff --git a/app/controllers/helps/faqs_controller.rb b/app/controllers/helps/faqs_controller.rb index 133748ed5..a18f49270 100644 --- a/app/controllers/helps/faqs_controller.rb +++ b/app/controllers/helps/faqs_controller.rb @@ -2,7 +2,7 @@ class Helps::FaqsController < ApplicationController skip_before_action :check_sign, :user_setup def index - faqs = Faq.select_without_id + faqs = Faq.select_without_id.order(updated_at: :desc) render json: faqs.as_json(:except => [:id]) end end