ActiveAdmin.register Region 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
  #
  # or
  #
  # permit_params do
  #   permitted = [:name, :code, :slug]
  #   permitted << :other if params[:action] == 'create' && current_user.admin?
  #   permitted
  # end
  index do
    selectable_column
    id_column
    column :name
    column :code
    column :countries_count do |region|
      region.countries.count
    end
    column :cities_count do |region|
      region.cities.count
    end
    actions
  end
end
