feat: add city and weather art models
- Create City model with attributes: name, country, latitude, longitude, and featured. - Create WeatherArt model with attributes: weather_date, weather_condition, description, and prompt. - Add migration files for creating cities and weather arts tables. - Include fixture files for cities and weather arts for testing. - Add basic test files for both models. These changes introduce new models and database tables to support city and weather art data, enabling future features related to weather information and city management.
This commit is contained in:
parent
81843f0c08
commit
42e0da1aa0
2
app/models/city.rb
Normal file
2
app/models/city.rb
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
class City < ApplicationRecord
|
||||||
|
end
|
2
app/models/weather_art.rb
Normal file
2
app/models/weather_art.rb
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
class WeatherArt < ApplicationRecord
|
||||||
|
end
|
13
db/migrate/20250117093758_create_cities.rb
Normal file
13
db/migrate/20250117093758_create_cities.rb
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
class CreateCities < ActiveRecord::Migration[8.0]
|
||||||
|
def change
|
||||||
|
create_table :cities do |t|
|
||||||
|
t.string :name
|
||||||
|
t.string :country
|
||||||
|
t.decimal :latitude
|
||||||
|
t.decimal :longitude
|
||||||
|
t.boolean :featured
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
12
db/migrate/20250117095400_create_weather_arts.rb
Normal file
12
db/migrate/20250117095400_create_weather_arts.rb
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
class CreateWeatherArts < ActiveRecord::Migration[8.0]
|
||||||
|
def change
|
||||||
|
create_table :weather_arts do |t|
|
||||||
|
t.date :weather_date
|
||||||
|
t.string :weather_condition
|
||||||
|
t.text :description
|
||||||
|
t.string :prompt
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
15
test/fixtures/cities.yml
vendored
Normal file
15
test/fixtures/cities.yml
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||||
|
|
||||||
|
one:
|
||||||
|
name: MyString
|
||||||
|
country: MyString
|
||||||
|
latitude: 9.99
|
||||||
|
longitude: 9.99
|
||||||
|
featured: false
|
||||||
|
|
||||||
|
two:
|
||||||
|
name: MyString
|
||||||
|
country: MyString
|
||||||
|
latitude: 9.99
|
||||||
|
longitude: 9.99
|
||||||
|
featured: false
|
13
test/fixtures/weather_arts.yml
vendored
Normal file
13
test/fixtures/weather_arts.yml
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||||
|
|
||||||
|
one:
|
||||||
|
weather_date: 2025-01-17
|
||||||
|
weather_condition: MyString
|
||||||
|
description: MyText
|
||||||
|
prompt: MyString
|
||||||
|
|
||||||
|
two:
|
||||||
|
weather_date: 2025-01-17
|
||||||
|
weather_condition: MyString
|
||||||
|
description: MyText
|
||||||
|
prompt: MyString
|
7
test/models/city_test.rb
Normal file
7
test/models/city_test.rb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
require "test_helper"
|
||||||
|
|
||||||
|
class CityTest < ActiveSupport::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
7
test/models/weather_art_test.rb
Normal file
7
test/models/weather_art_test.rb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
require "test_helper"
|
||||||
|
|
||||||
|
class WeatherArtTest < ActiveSupport::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user