fix: access city attribute correctly in WeatherArt model
- Modified the formatted_time method to use 'self' when accessing the city attribute - This change fixes a bug where the city attribute was not being accessed correctly, ensuring proper timezone information retrieval.
This commit is contained in:
parent
968efb5492
commit
df074a81a8
@ -70,7 +70,7 @@ class WeatherArt < ApplicationRecord
|
||||
|
||||
def formatted_time(type = :date, use_local_timezone = false)
|
||||
# 获取时区
|
||||
timezone_info = city&.country&.timezones.present? ?
|
||||
timezone_info = self.city&.country&.timezones.present? ?
|
||||
eval(self.city.country.timezones).first :
|
||||
{ "zoneName" => "UTC", "gmtOffsetName" => "UTC+00:00" }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user