today_ai_weather/app/models/city.rb

14 lines
280 B
Ruby
Raw Normal View History

class City < ApplicationRecord
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
end