Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Dirty API to compare objects of custom type using dumps #851

Merged

Conversation

andrykonchin
Copy link
Member

@andrykonchin andrykonchin commented Jan 14, 2025

Changes:

  • fix Dirty API and don't require custom type to implement #== method
  • add field's option :comparable
  • change the way of duplicating objects of custom type (for Dirty API) - switch from Dynamoid's dumping mechanism (with dynamoid_dump/dynamoid_load methods) to Marshal.dump/Marshal.load

The option :comparable affects how old and new objects of custom type are compared - by comparing their dumps or using #== method. If it is true - objects are compared with #==. They are compared by comparing dumps otherwise.

Example:

field :amount, Money, comparable: true

Close #848

Add field's option :comparable that affects how old and new objects of custom type are compared - by comparing dumps or using #== method.
@andrykonchin andrykonchin force-pushed the ak/don-require-custom-type-to-implement-equality-method branch from f7cca53 to 9604f25 Compare January 14, 2025 19:35
Copy link

Code Coverage

Package Line Rate Health
dynamoid 92%
Summary 92% (3426 / 3739)

Minimum allowed line rate is 90%

@andrykonchin andrykonchin merged commit a16be4e into master Jan 14, 2025
70 checks passed
@andrykonchin andrykonchin deleted the ak/don-require-custom-type-to-implement-equality-method branch January 14, 2025 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fields of custom type that does not implement #== are always dirty
1 participant