ember-parse-adapter icon indicating copy to clipboard operation
ember-parse-adapter copied to clipboard

Error when saving record which has many children

Open musnit opened this issue 10 years ago • 2 comments

When saving a record with many children, when serializing, an error is thrown in the serializeHasMany function of EmberParseAdapter.Serializer line 184.

      "className": child.parseClassName(),

The parseClassName function does not exist on the child record. This seems like an issue - is it supposed to be calling the parseClassName method on the serializer/adapter rather?

I got around this in my code by implementing a parseClassName method on my own model, which just returns the parse class name of that model.

Seems like a fix would be to change this line to call the parseClassName method on the serializer, rather than the non-existent method on the child model. Does that sound OK, or am I getting confused somewhere?

I'll make the fix if my solution sounds fine.

musnit avatar Feb 11 '15 09:02 musnit

+1 for this issue; this sounds big, too bad the maintainer gave up on the project...

It seems, giving my complete inexperience with Ember, that in this case Ember uses a snapshot of the Model instead of the actual class... That means the parseClassName() method won't exist in a snapshot.

igorsantos07 avatar Apr 27 '15 04:04 igorsantos07

I think I got the issue... I'll be sending a PR soon

igorsantos07 avatar Apr 27 '15 04:04 igorsantos07