songtianlun
c11d10c86a
- Change city name display to localized name in both index and show views - Modify schema to use bigint for certain foreign keys - Correct country codes in seeds for accurate data representation These changes improve the handling of city names, ensuring they are displayed in the appropriate localized format and ensuring well-typed foreign key relationships in the schema.
49 lines
1.0 KiB
Ruby
49 lines
1.0 KiB
Ruby
usa = Country.find_by code: 'US'
|
|
|
|
City.create!([
|
|
{
|
|
name: 'San Francisco',
|
|
latitude: 37.7749,
|
|
longitude: -122.4194,
|
|
country: usa,
|
|
timezone: 'America/Los_Angeles',
|
|
active: true,
|
|
priority: 100,
|
|
last_weather_fetch: 10.hours.ago,
|
|
last_image_generation: 10.hours.ago
|
|
},
|
|
{
|
|
name: 'Chicago',
|
|
latitude: 41.8781,
|
|
longitude: -87.6298,
|
|
country: usa,
|
|
timezone: 'America/Chicago',
|
|
active: true,
|
|
priority: 100,
|
|
last_weather_fetch: 10.hours.ago,
|
|
last_image_generation: 10.hours.ago
|
|
},
|
|
{
|
|
name: 'New York City',
|
|
latitude: 40.7128,
|
|
longitude: -74.0060,
|
|
country: usa,
|
|
timezone: 'America/New_York',
|
|
active: true,
|
|
priority: 100,
|
|
last_weather_fetch: 10.hours.ago,
|
|
last_image_generation: 10.hours.ago
|
|
},
|
|
{
|
|
name: 'Los Angeles',
|
|
latitude: 34.0522,
|
|
longitude: -118.2437,
|
|
country: usa,
|
|
timezone: 'America/Los_Angeles',
|
|
active: true,
|
|
priority: 100,
|
|
last_weather_fetch: 10.hours.ago,
|
|
last_image_generation: 10.hours.ago
|
|
}
|
|
])
|