I am stuck on an EmberJS problem for the life of me and simply cannot get my head around it.
What I have is a collection of resources specified as a resource in my Router, like. This in turn, loads another resource which is basically a singular instance of the 'resources collection'. Essentially my router looks like this:
App.Router.map(function(){
this.resource('stacks', function(){
this.resource('stack',{path:'/:stack_id'});
});
});
However, when I visit the /stacks page, I get:
Assertion failed: Cannot call get with 'id' on an undefined object
Both Stacks and Stack have a route defined later in the code like 'Ember.Route.extend({})' for each of them and the Stacks route returns the 'stack' model from the data store. Is there something explicitly wrong above here, cause I am following examples and it doesn't look to me that i am doing anything incorrect.
Thank you
does your stack model have a property on it called stack_id? if not, you need to implement a serialize method on the stack route
App.StackRoute = Em.Route.extend({
serialize: function(model){
return { stack_id: model.get('id')};
}
});