2025-01-17 18:05:42 +08:00
|
|
|
class City < ApplicationRecord
|
2025-01-18 21:42:31 +08:00
|
|
|
has_many :weather_arts
|
|
|
|
|
|
|
|
scope :featured, -> { where(featured: true) }
|
|
|
|
|
|
|
|
def current_weather_art
|
|
|
|
weather_arts.find_by(weather_date: Date.current)
|
|
|
|
end
|
|
|
|
|
|
|
|
def weather_art_for_date(date)
|
|
|
|
weather_arts.find_by(weather_date: date)
|
|
|
|
end
|
2025-01-17 18:05:42 +08:00
|
|
|
end
|