feat: improve retrieval of weather arts
- Include associated city and image attachment in popular, random, latest, and featured arts queries to enhance data accessibility and performance. - This modification reduces N+1 query issues by eager-loading associations, leading to improved query performance when accessing related data.
This commit is contained in:
parent
496dcf83a9
commit
18977a9d42
@ -1,9 +1,9 @@
|
||||
class HomeController < ApplicationController
|
||||
def index
|
||||
@popular_arts = WeatherArt.by_popularity(3)
|
||||
@random_arts = WeatherArt.random(3)
|
||||
@latest_arts = WeatherArt.latest(6)
|
||||
@featured_arts = WeatherArt.includes(:city).order(created_at: :desc).limit(5)
|
||||
@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)
|
||||
set_meta_tags(
|
||||
title: "AI-Generated Weather Art",
|
||||
description: "Experience weather through artistic AI visualization. Daily updated weather art for cities worldwide.",
|
||||
|
@ -1,6 +1,15 @@
|
||||
require "active_support/core_ext/integer/time"
|
||||
|
||||
Rails.application.configure do
|
||||
config.after_initialize do
|
||||
Bullet.enable = true
|
||||
Bullet.alert = false
|
||||
Bullet.bullet_logger = true
|
||||
Bullet.console = true
|
||||
Bullet.rails_logger = true
|
||||
Bullet.add_footer = true
|
||||
end
|
||||
|
||||
# Settings specified here will take precedence over those in config/application.rb.
|
||||
|
||||
# Make code changes take effect immediately without server restart.
|
||||
|
Loading…
Reference in New Issue
Block a user