<commit_before>module FixtureHelpers

    extend ActiveSupport::Concern

    included do
        alias_method_chain :table_rows, :custom_autoset_fields
    end

    def table_rows_with_custom_autoset_fields
        results = table_rows_without_custom_autoset_fields
        if model_class
            results[ table_name ].each do | row |
                row['visible_id'] ||= Skr::SequentialId.next_for( model_class ) if model_class.column_names.include?('visible_id')
                row['hash_code' ] = Lanes::Strings.random if model_class.column_names.include?('hash_code')
                row['created_at'] = Time.now if model_class.column_names.include?('created_at')
                row['updated_at'] = Time.now if model_class.column_names.include?('updated_at')
                # 135138680 == "admin"
                row['created_by_id'] = 135138680  if model_class.column_names.include?('created_by_id')
                row['updated_by_id'] = 135138680 if model_class.column_names.include?('updated_by_id')
            end
        end
        results
    end
end

ActiveRecord::FixtureSet.send :include, FixtureHelpers<commit_msg>only set _ids if not already present<commit_after>module FixtureHelpers

    extend ActiveSupport::Concern

    included do
        alias_method_chain :table_rows, :custom_autoset_fields
    end

    def table_rows_with_custom_autoset_fields
        results = table_rows_without_custom_autoset_fields
        if model_class
            results[ table_name ].each do | row |
                row['visible_id'] ||= Skr::SequentialId.next_for( model_class ) if model_class.column_names.include?('visible_id')
                row['hash_code' ] = Lanes::Strings.random if model_class.column_names.include?('hash_code')
                row['created_at'] = Time.now if model_class.column_names.include?('created_at')
                row['updated_at'] = Time.now if model_class.column_names.include?('updated_at')
                # 135138680 == "admin"
                row['created_by_id'] ||= 135138680  if model_class.column_names.include?('created_by_id')
                row['updated_by_id'] ||= 135138680 if model_class.column_names.include?('updated_by_id')
            end
        end
        results
    end
end

ActiveRecord::FixtureSet.send :include, FixtureHelpers
{'fraction_non_alphanumeric': 0.09544468546637744, 'fraction_numerical': 0.023427331887201735, 'mean_word_length': 2.9690189328743544, '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': '4137648', 'n_tokens_mistral': 742, 'n_tokens_neox': 687, 'n_words': 117}