diff --git a/Gemfile b/Gemfile index c36ff7d..18c9b8a 100644 --- a/Gemfile +++ b/Gemfile @@ -45,7 +45,7 @@ gem "devise", "~> 4.9" gem "activeadmin", "~> 3.2" gem "friendly_id", "~> 5.5" -gem 'kaminari', '~> 1.2' +gem "kaminari", "~> 1.2" # gem "whenever", "~> 1.0" gem "ruby-openai", "~> 7.3" diff --git a/app/controllers/arts_controller.rb b/app/controllers/arts_controller.rb index b70273a..fb1193f 100644 --- a/app/controllers/arts_controller.rb +++ b/app/controllers/arts_controller.rb @@ -3,18 +3,18 @@ class ArtsController < ApplicationController @regions = Region.all @current_region = Region.find(params[:region]) if params[:region].present? - @weather_arts = WeatherArt.includes(city: [:country, { country: :region }]) + @weather_arts = WeatherArt.includes(city: [ :country, { country: :region } ]) if @current_region @weather_arts = @weather_arts.joins(city: :country) .where(countries: { region_id: @current_region.id }) end - @weather_arts = if params[:sort] == 'oldest' + @weather_arts = if params[:sort] == "oldest" @weather_arts.order(created_at: :asc) - else + else @weather_arts.order(created_at: :desc) - end + end @weather_arts = @weather_arts.page(params[:page]).per(10) end diff --git a/config/routes.rb b/config/routes.rb index 0bdf657..a1a5e48 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,7 +6,7 @@ Rails.application.routes.draw do resources :cities, only: [ :index, :show ] do resources :weather_arts, path: "weather", only: [ :show ], param: :slug end - resources :arts, only: [:index] + resources :arts, only: [ :index ] # namespace :admin do # resources :cities