From 6f2a42b92b700d68b877b5d5232ee4f1ef9758a4 Mon Sep 17 00:00:00 2001 From: songtianlun Date: Sun, 16 Feb 2025 01:14:25 +0800 Subject: [PATCH] refactor: prioritize latest arts over featured - Comment out featured arts in home controller - Update index.html.erb to display latest arts instead of featured This change aims to keep the displayed arts up-to-date and fresh by showing the latest ones, enhancing user experience by providing more current content. --- app/controllers/home_controller.rb | 2 +- app/views/home/index.html.erb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index db0c1a2..49c3ea7 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -3,7 +3,7 @@ class HomeController < ApplicationController @popular_arts = WeatherArt.includes(:city, :image_attachment).by_popularity(3) # @random_arts = WeatherArt.includes(:city, :image_attachment).random(3) @latest_arts = WeatherArt.includes(:city, :image_attachment).latest(6) - @featured_arts = WeatherArt.includes(:city, :image_attachment).order(created_at: :desc).limit(5) + # @featured_arts = WeatherArt.includes(:city, :image_attachment).order(created_at: :desc).limit(5) set_meta_tags( title: "AI-Generated Weather Art", description: "Experience weather through artistic AI visualization. Daily updated weather art for cities worldwide.", diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index 1a32e67..9f238b1 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -1,9 +1,9 @@
- <% if @featured_arts.first&.image&.attached? %> + <% if @latest_arts.first&.image&.attached? %>
- <%= image_tag @featured_arts.first.preview_image(:large).processed, class: "w-full h-full object-cover" %> + <%= image_tag @latest_arts.first.preview_image(:large).processed, class: "w-full h-full object-cover" %>
<% end %>