today_ai_weather/app/controllers/home_controller.rb
songtianlun f79299d707 feat: update art listings in home controller
- Modify the popular arts query to include city and country relationships
- Ensure the latest arts query also includes necessary associations
- Removed deprecated commented code for clarity

These changes improve data retrieval by establishing better relationships to
cities and their countries. This enhances the availability of data for
the views rendering the arts and keeps the code clean by removing
unnecessary comments.
2025-02-17 14:38:29 +08:00

14 lines
708 B
Ruby

class HomeController < ApplicationController
def index
@popular_arts = WeatherArt.includes(:image_attachment, city: :country).by_popularity(3)
@latest_arts = WeatherArt.includes(:image_attachment, city: :country).latest(6)
# @random_arts = WeatherArt.includes(:city, :image_attachment).random(3)
# @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.",
keywords: "AI weather art, weather visualization, city weather, artificial intelligence"
)
end
end