Create Record error when switching routes


#1

I’m getting the following error when trying to create a record from switching routes

Error: Assertion Failed: You may not pass `null` as id to the store's find method

The problem is in assigning a model to a parent belongs_to association in

var newSchool = this.store.createRecord('deal', {
          name: newScholName,
          parent: this.get('model.school'),
        });

it works from entering the route freashly but throws the assertion when navigating between routes. The parent model is also of the same type and has a null parent value.

If the parent value is left out of createRecord it works regardless


#2

The problem is that this.get(“model.school”) is returning null. Are you passing anything to the new route? I wonder if the following, from the manual, has any bearing on this.

If the new route has dynamic segments, you need to pass either
a model or an identifier for each segment. Passing a model will
skip that segment's model hook. Passing an identifier will run
the model hook and you'll be able to access the identifier in the
params. See Links for more detail.

http://guides.emberjs.com/v1.13.0/routing/redirection/


#3

Yeah, but if I log this.store.get(‘model.school’) before the createRecord it logs the model but it still throws the assertion. Also if this is relevent, it sets all the propetires in the store before parent but after it they are null.