today_ai_weather/app/controllers/arts_controller.rb
songtianlun 3a6d247451 feat: add pagination to weather arts gallery
- Introduce ArtsController with index action
- Create index view for displaying weather arts
- Implement Kaminari for pagination functionality
- Add necessary routes for accessing arts
- Update Gemfile to include Kaminari gem
- Create views for pagination controls

This implementation enhances the Weather Arts Gallery, allowing users to view and navigate through a collection of AI-generated weather arts easily. Pagination controls have been added to improve usability.
2025-01-23 14:10:13 +08:00

9 lines
301 B
Ruby

class ArtsController < ApplicationController
def index
@weather_arts = WeatherArt.includes(:city, city: [ :country, { country: :region } ])
.order(created_at: :desc)
.page(params[:page])
.per(2)
end
end