diff --git a/app/controllers/events_controller.rb b/app/controllers/events_controller.rb index fd45637..6d8f261 100644 --- a/app/controllers/events_controller.rb +++ b/app/controllers/events_controller.rb @@ -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 diff --git a/app/views/merged/view/_section_events.haml b/app/views/merged/view/_section_events.haml index b2ea63c..19eed37 100644 --- a/app/views/merged/view/_section_events.haml +++ b/app/views/merged/view/_section_events.haml @@ -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