Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
- Add official Rails 7.2 support. [#279](https://github.com/splitwise/super_diff/pull/279)
- Add official Rails 8.0 support. [#281](https://github.com/splitwise/super_diff/pull/281)

### Bug fixes

- Fix `attributes_for_super_diff` (in monkey patch of `ActiveRecord::Base`) which would fail for classes that don't have a primary key.
([#282](https://github.com/splitwise/super_diff/pull/282))

### Other changes

- Fix `logger` dependency issues in CI. [#277](https://github.com/splitwise/super_diff/pull/277)
Expand Down
2 changes: 1 addition & 1 deletion lib/super_diff/active_record/monkey_patches.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def attributes_for_super_diff
id_attr = self.class.primary_key

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