<commit_before>ActiveAdmin.register LegalNotice do
  menu parent: I18n.t('admin_menu.posts')
  includes :translations

  permit_params :id,
                :type,
                :online,
                :user_id,
                translations_attributes: [
                  :id, :locale, :title, :content
                ]

  decorate_with LegalNoticeDecorator
  config.clear_sidebar_sections!

  batch_action :toggle_online do |ids|
    About.find(ids).each { |item| item.toggle! :online }
    redirect_to :back, notice: t('active_admin.batch_actions.flash')
  end

  batch_action :reset_cache do |ids|
    About.find(ids).each(&:touch)
    redirect_to :back, notice: t('active_admin.batch_actions.reset_cache')
  end

  # Sortable
  sortable
  config.sort_order = 'position_asc'
  config.paginate   = false<commit_msg>Fix N+1 query in AA LegalNotice#index page<commit_after>ActiveAdmin.register LegalNotice do
  menu parent: I18n.t('admin_menu.posts')
  includes :translations, :user, :picture

  permit_params :id,
                :type,
                :online,
                :user_id,
                translations_attributes: [
                  :id, :locale, :title, :content
                ]

  decorate_with LegalNoticeDecorator
  config.clear_sidebar_sections!

  batch_action :toggle_online do |ids|
    About.find(ids).each { |item| item.toggle! :online }
    redirect_to :back, notice: t('active_admin.batch_actions.flash')
  end

  batch_action :reset_cache do |ids|
    About.find(ids).each(&:touch)
    redirect_to :back, notice: t('active_admin.batch_actions.reset_cache')
  end

  # Sortable
  sortable
  config.sort_order = 'position_asc'
  config.paginate   = false
{'fraction_non_alphanumeric': 0.10071090047393365, 'fraction_numerical': 0.002962085308056872, 'mean_word_length': 2.795505617977528, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '339135', 'n_tokens_mistral': 547, 'n_tokens_neox': 519, 'n_words': 107}