today_ai_weather/app/admin/countries.rb
songtianlun ebaf7a3f34 feat: add countries and regions management
- Implement Country and Region models
- Establish relationships between City, Country, and Region
- Update ActiveAdmin setup for managing countries and regions
- Add localization support for cities and countries in multiple languages
- Create necessary migrations to support the new schema

This update allows for better categorization of cities under their respective countries and regions, enhancing geographical structure and support for multilingual features.
2025-01-21 18:27:26 +08:00

37 lines
824 B
Ruby

ActiveAdmin.register Country do
# See permitted parameters documentation:
# https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters
#
# Uncomment all parameters which should be permitted for assignment
#
permit_params :name, :code, :region_id
#
# or
#
# permit_params do
# permitted = [:name, :code, :slug, :region_id]
# permitted << :other if params[:action] == 'create' && current_user.admin?
# permitted
# end
index do
selectable_column
id_column
column :name
column :code
column :region
column :cities_count do |country|
country.cities.count
end
actions
end
form do |f|
f.inputs do
f.input :region
f.input :name
f.input :code
end
f.actions
end
end