diff --git a/app/controllers/cities_controller.rb b/app/controllers/cities_controller.rb index 1bcf857..6a6367b 100644 --- a/app/controllers/cities_controller.rb +++ b/app/controllers/cities_controller.rb @@ -1,8 +1,9 @@ class CitiesController < ApplicationController def index - @cities = City.friendly.find(params[:id]) + @cities = City.all.order(:name) end def show + @city = City.friendly.find(params[:id]) end end diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 95f2992..14cef42 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -1,4 +1,6 @@ class HomeController < ApplicationController def index + @latest_arts = WeatherArt.includes(:city).order(created_at: :desc).limit(6) + @featured_arts = WeatherArt.includes(:city).order(created_at: :desc).limit(5) end end diff --git a/app/controllers/weather_arts_controller.rb b/app/controllers/weather_arts_controller.rb index 0c1e6f4..1f5a178 100644 --- a/app/controllers/weather_arts_controller.rb +++ b/app/controllers/weather_arts_controller.rb @@ -1,4 +1,6 @@ class WeatherArtsController < ApplicationController def show + @city = City.friendly.find(params[:city_id]) + @weather_art = @city.weather_arts.find(params[:id]) end end diff --git a/app/views/cities/index.html.erb b/app/views/cities/index.html.erb index ecfe641..cbd8c97 100644 --- a/app/views/cities/index.html.erb +++ b/app/views/cities/index.html.erb @@ -1,2 +1,18 @@ -
Find me in app/views/cities/index.html.erb
+Latitude: <%= city.latitude %>
+Longitude: <%= city.longitude %>
+Find me in app/views/cities/show.html.erb
+<%= art.description %>
+Find me in app/views/home/index.html.erb
+Discover the beauty of weather through AI-generated art
+<%= art.weather_date.strftime("%Y-%m-%d") %>
+<%= art.description %>
+Find me in app/views/weather_arts/show.html.erb
+<%= @weather_art.prompt %>
+