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.
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.