apotonick/representable — pull request #70 by jpslav (2014-01-20 00:25:20+00:00)
Title: modified deserializer to create new objects as needed when :sync'ing

When `:parse_strategy` is set to `:sync`, Representable assumes that the object exists. This is often true. But sometimes it can be that a developer (i.e. me :-) is dealing with an object that starts off `null` but that he'd like to later `:sync` once it is created. When an object does not exist and the `:sync` strategy is used, things blow up with `NilClass` errors.

Nick et al have already pointed this out in the code:(https://github.com/apotonick/representable/blob/master/lib/representable/deserializer.rb#L36)

I *think* the solution may be easy, and since I needed it to move forward I made a fork and am giving it a go. Putting it here as a pull request in case Nick thinks this is in fact the solution. If I'm missing something, feel free to say so and ignore. I don't have much experience with the collection deserialization, so maybe there's something there I'm not considering.

See my posts on the roar-talk google group for reference: http://goo.gl/O25Vmh