The original ActiveRecordProxies have one very annoying problem. When you change a value on an object, the object is immediately saved to the database. This way you miss the best part about the Active Record pattern and it makes bindings unusable. When a user changes a value in the view, he should be able to save or reload. Saving the change immediately to the database would make that almost impossible.
At first I tried fixing ActiveRecordProxy myself, but that didn’t work. So I decided to start from scratch. The result of can be downloaded here
What’s different from the normal ActiveRecordProxy class:
- support for save and reload.
- minimal support for validations. If you use saveWithError, an NSError object is returned when saving fails. The userDict of this error should contain the validation errors.
rails like setterMethods: you can now use(Updated: this already seems to work on normal ActiveRecordProxy objects)
CustomerProxy.name = "test"instead of