sxross / MotionModel

Simple Model and Validation Mixins for RubyMotion
MIT License
192 stars 67 forks source link

Model.serialize_to_file generates NSKeyedArchiver warnings #33

Closed wink closed 11 years ago

wink commented 11 years ago

Calling Model.serialize_to_file generates the following warning for each and every record being serialized:

*\ NSKeyedArchiver warning: replacing existing value for key 'id'; probable duplication of encoding keys in class hierarchy

This occurs even when I'm writing for the first time to a brand new file, by using Model.serialize_to_file('never_been_used.dat')

wink commented 11 years ago

If you call Model.columns multiple times, it was adding a new :id field each time. This can happen if you call Model.columns once from the model itself and a second time from an included mixin/module. The respond_to? method currently being used is applied to the class itself, but the class will never respond to :id, because the :id method is on the instance, not the class.

DougPuchalski commented 11 years ago

Steve, this is also fixed in my optimizations branch, along with many other things in prep for sql. Sql is actually getting close, I want to discuss with you ramifications of merging that as well.

https://github.com/aceofspades/motionmodel/tree/optimizations does pass specs. Want to have a look at that before deciding whether to merge this one?

sxross commented 11 years ago

I'll get on this by Thursday.

sxross commented 11 years ago

This is merged but there is further comment. I'm going to close it. Reopen if you think it is still unresolved @wink.