Class: ActiveRecord::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/super_diff/active_record/monkey_patches.rb

Overview

rubocop:disable Style/ClassAndModuleChildren

Instance Method Summary collapse

Instance Method Details

#attributes_for_super_diffObject

TODO: Remove this monkey patch if possible



6
7
8
9
10
11
12
# File 'lib/super_diff/active_record/monkey_patches.rb', line 6

def attributes_for_super_diff
  id_attr = self.class.primary_key

  (attributes.keys.sort - [id_attr]).reduce(
    { id_attr.to_sym => id }
  ) { |hash, key| hash.merge(key.to_sym => attributes[key]) }
end