From 31c2913ea6ff024a91ffdea27264d7a6421d20b9 Mon Sep 17 00:00:00 2001 From: songtianlun Date: Mon, 3 Feb 2025 11:15:31 +0800 Subject: [PATCH] refactor: adjust ordering of weather arts - Change ordering of previous weather art to use 'id' descending - Change ordering of next weather art to use 'id' ascending - Remove unnecessary blank line in seeds file These changes enhance the consistency of the weather art navigation by using 'id' for ordering, ensuring the correct retrieval of records. --- app/controllers/weather_arts_controller.rb | 4 ++-- db/seeds.rb | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/controllers/weather_arts_controller.rb b/app/controllers/weather_arts_controller.rb index 0dee48d..a01f226 100644 --- a/app/controllers/weather_arts_controller.rb +++ b/app/controllers/weather_arts_controller.rb @@ -5,12 +5,12 @@ class WeatherArtsController < ApplicationController @previous_weather_art = @city.weather_arts .where("id < ?", @weather_art.id) - .order(weather_date: :desc) + .order(id: :desc) .first @next_weather_art = @city.weather_arts .where("id > ?", @weather_art.id) - .order(weather_date: :asc) + .order(id: :asc) .first ahoy.track "View Weather Art", { diff --git a/db/seeds.rb b/db/seeds.rb index 412c784..6779d9b 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -204,4 +204,3 @@ guangzhou_weather_art3.image.attach( filename: "sample-guangzhou-weather-art-2.png", content_type: "image/png" ) -