basic sort for stories
This commit is contained in:
@ -2,7 +2,9 @@ class StoriesController < ApplicationController
|
||||
before_action :set_story, only: %i[ show edit update destroy ]
|
||||
|
||||
def index
|
||||
@stories = Story.all.page params[:page]
|
||||
@q = Story.ransack(params[:q])
|
||||
@q.sorts = 'created_at desc' if @q.sorts.empty?
|
||||
@stories = @q.result(distinct: true).page( params[:page])
|
||||
end
|
||||
|
||||
def show
|
||||
|
Reference in New Issue
Block a user