<commit_before>require 'activeadmin'
require 'cancan'
 
ActiveAdmin::Namespace.class_eval do
  alias_method :old_register, :register
  
  def register(resource_class, options = {}, &block)
    config = find_or_build_resource(resource_class, options)
    register_resource_controller(config)
    resource_dsl.prepare_menu(config)
    config = old_register(resource_class, options, &block)
    config.controller.load_and_authorize_resource
    config    
  end
end

ActiveAdmin::DSL.class_eval do
  def prepare_menu(config)
    @config = config
    resource = controller.resource_class
    instance_eval do
      menu :if => proc{ can?(:manage, resource) }
    end
  end
end

CanCan::ControllerResource.class_eval do
  def collection_instance=(instance)
  end
  
  def resource_instance=(instance)
  end
end<commit_msg>Added ugly hack to pass over differenet object_ids of classes with new req<commit_after>require 'activeadmin'
require 'cancan'
 
ActiveAdmin::Namespace.class_eval do
  alias_method :old_register, :register
  
  def register(resource_class, options = {}, &block)
    config = find_or_build_resource(resource_class, options)
    register_resource_controller(config)
    resource_dsl.prepare_menu(config)
    config = old_register(resource_class, options, &block)
    config.controller.load_and_authorize_resource
    config    
  end
end

ActiveAdmin::DSL.class_eval do
  def prepare_menu(config)
    @config = config
    resource = controller.resource_class
    instance_eval do
      menu :if => proc{ can?(:manage, Kernel.const_get(resource.to_s.classify)) }
    end
  end
end

CanCan::ControllerResource.class_eval do
  def collection_instance=(instance)
  end
  
  def resource_instance=(instance)
  end
end
{'fraction_non_alphanumeric': 0.07932831499710481, 'fraction_numerical': 0.0, 'mean_word_length': 4.647058823529412, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4809602', 'n_tokens_mistral': 529, 'n_tokens_neox': 524, 'n_words': 117}