<commit_before>require 'active_record'
require 'validations/uniqueness_without_deleted'


module ActiveRecord
  class Relation
    def paranoid?
      klass.try(:paranoid?) ? true : false
    end
    
    def paranoid_deletion_attributes
      { klass.paranoid_column => klass.delete_now_value }
    end
    
    alias_method :destroy!, :destroy
    def destroy(id)
      if paranoid?
        update(id, paranoid_deletion_attributes)
      else
        destroy!(id)<commit_msg>Compensated for update(id,attributes) requiring array of attributes when passing an array of ids<commit_after>require 'active_record'
require 'validations/uniqueness_without_deleted'


module ActiveRecord
  class Relation
    def paranoid?
      klass.try(:paranoid?) ? true : false
    end
    
    def paranoid_deletion_attributes
      { klass.paranoid_column => klass.delete_now_value }
    end
    
    alias_method :destroy!, :destroy
    def destroy(id)
      if paranoid?
        attributes = paranoid_deletion_attributes
        if id.is_a?(Array)
          # For some reason, if you pass an array of IDs, ActiveRecord expects
          # an array of attributes too; you can expect the same attributes to be 
          # applied to all of the updated records.
          # To compensate, pass an array of the same attributes instead
          attributes = id.map {|i| attributes}
        end
        update(id, attributes)
      else
        destroy!(id)
{'fraction_non_alphanumeric': 0.06462821403752605, 'fraction_numerical': 0.0, 'mean_word_length': 2.789473684210526, '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': '5084233', 'n_tokens_mistral': 417, 'n_tokens_neox': 397, 'n_words': 122}