liveh2o / active_remote

Active Remote provides Active Record-like object-relational mapping over RPC. It's Active Record for your platform.
MIT License
63 stars 23 forks source link

Attributes may be stomped on when update results in an error #78

Closed mogman1 closed 4 years ago

mogman1 commented 4 years ago
ccp = MyClass.find(guid: '123abc')
ccp.guid # '123abc'
ccp.update_attributes(other_field: 'xyz789') # returns false due to constraint failure
ccp.guid # nil

When the call to update returns an object with all empty fields due to an error, the attributes on the original object get stomped on. Rather than update the attributes with whatever is returned when an error happens, it would seem like perhaps the original attributes should stay exactly the same and only have any errors get appended to the object. Then the caller can make any decisions on what to do next.

mogman1 commented 4 years ago

Unable to reproduce anymore