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.
This commit is contained in:
parent
884e1dfc9f
commit
31c2913ea6
@ -5,12 +5,12 @@ class WeatherArtsController < ApplicationController
|
|||||||
|
|
||||||
@previous_weather_art = @city.weather_arts
|
@previous_weather_art = @city.weather_arts
|
||||||
.where("id < ?", @weather_art.id)
|
.where("id < ?", @weather_art.id)
|
||||||
.order(weather_date: :desc)
|
.order(id: :desc)
|
||||||
.first
|
.first
|
||||||
|
|
||||||
@next_weather_art = @city.weather_arts
|
@next_weather_art = @city.weather_arts
|
||||||
.where("id > ?", @weather_art.id)
|
.where("id > ?", @weather_art.id)
|
||||||
.order(weather_date: :asc)
|
.order(id: :asc)
|
||||||
.first
|
.first
|
||||||
|
|
||||||
ahoy.track "View Weather Art", {
|
ahoy.track "View Weather Art", {
|
||||||
|
@ -204,4 +204,3 @@ guangzhou_weather_art3.image.attach(
|
|||||||
filename: "sample-guangzhou-weather-art-2.png",
|
filename: "sample-guangzhou-weather-art-2.png",
|
||||||
content_type: "image/png"
|
content_type: "image/png"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user