marcoarment / FCModel

An alternative to Core Data for people who like having direct SQL access.
MIT License
1.65k stars 173 forks source link

Fix reverting unsaved changes for entities with custom (de)serialization #56

Closed felixLam closed 10 years ago

felixLam commented 10 years ago

The issue is (IMHO) that self._rowValuesInDatabase[fieldName] yields for BLOB columns the unserialized NSData object. If however an entity chooses to deserialize this to e.g. UIImage the deserialization was not applied when reverting all unsaved changes. The method revertUnsavedChangeToFieldName: did so correctly. The following change simply calls revertUnsavedChangeToFieldName: for all unsaved columns in revertUnsavedChanges.

felixLam commented 10 years ago

I will try to add a test case later tomorrow.

marcoarment commented 10 years ago

Great catch, thanks.