songtianlun
34c05232ee
- Standardize string quotes in various files for consistency. - Remove commented-out tests from cities and weather_arts controllers to improve readability. - Clean up admin_users and weather_arts fixture files by commenting out unused entries instead of removing them. These changes are aimed at enhancing code readability and maintainability, ensuring that code adheres to style guidelines without removing useful comments for future reference.
54 lines
1.3 KiB
Ruby
54 lines
1.3 KiB
Ruby
ActiveAdmin.register City do
|
|
controller do
|
|
def find_resource
|
|
scoped_collection.friendly.find(params[:id])
|
|
end
|
|
end
|
|
|
|
# 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, :country, :latitude, :longitude, :active, :priority, :timezone, :region, :last_weather_fetch, :last_image_generation, :slug
|
|
#
|
|
# or
|
|
#
|
|
# permit_params do
|
|
# permitted = [:name, :country, :latitude, :longitude, :active, :priority, :timezone, :region, :last_weather_fetch, :last_image_generation, :slug]
|
|
# permitted << :other if params[:action] == 'create' && current_user.admin?
|
|
# permitted
|
|
# end
|
|
|
|
index do
|
|
selectable_column
|
|
id_column
|
|
column :name
|
|
column :slug
|
|
column :latitude
|
|
column :longitude
|
|
column :active
|
|
column :created_at
|
|
actions
|
|
end
|
|
|
|
filter :name
|
|
filter :active
|
|
|
|
form do |f|
|
|
f.inputs do
|
|
f.input :active
|
|
f.input :name
|
|
f.input :country, as: :String
|
|
f.input :latitude
|
|
f.input :longitude
|
|
f.input :priority
|
|
f.input :timezone
|
|
f.input :region
|
|
f.input :last_weather_fetch
|
|
f.input :last_image_generation
|
|
end
|
|
f.actions
|
|
end
|
|
end
|