Given I am using Hanami Model version 0.6.1, I would like the repository update only the changed attributes of an entity.
For example:
user_instance1 = UserRepository.find(1)
user_instance1.name = 'John'
user_instance2 = UserRepository.find(1)
user_instance2.email = 'john@email.com'
UserRepository.update(user_instance1)
#expected: UPDATE USER SET NAME = 'John' WHERE ID = 1
UserRepository.update(user_instance2)
#expected: UPDATE USER SET EMAIL = 'john@email.com' WHERE ID = 1
But what it happens is that the second command overrides all fields, including those which were not changed.
I know I can use the Hanami::Entity::DirtyTracking
to get all changed attributes, but I do not know how to update an entity partially with these attributes.
Is there a way to do this?