fix event ordering

This commit is contained in:
Torsten 2023-09-06 10:16:40 +03:00
parent cc12f4a5a3
commit 358e95f701
2 changed files with 2 additions and 2 deletions

View File

@ -2,7 +2,7 @@ class EventsController < ApplicationController
before_action :set_event, only: %i[ show edit update destroy ]
def index
@events = Event.where("start_date > ? " , Date.today - 3.days)
@events = Event.where("start_date > ? " , Date.today - 3.days).order(:start_date)
end
def show

View File

@ -3,7 +3,7 @@
= link_to "See all events" , "/events" , class: :underline
.flex.justify-center
.grid.grid-cols-1.md:grid-cols-2.lg:grid-cols-4
- one, two , three, four = *Event.where("start_date > ? " , Date.today - 3.days).limit(4)
- one, two , three, four = *Event.where("start_date > ? " , Date.today - 3.days).limit(4).order(:start_date)
%div= render( "events/event_small" , event: one) if one
.hidden.md:block= render( "events/event_small" , event: two) if two
.hidden.lg:block= render( "events/event_small" , event: three) if three