Hi,
I want to include parameters in my urls which together determine which record to display rather than just relying on the (id) primary key.
So
/page/slug or /posts/dd/mm/yyyy/slug
rather than
page/id or posts/id
It’s obviously important (in the posts example here) that all parameters in url are taken into account in finding the record, not (for example) just the slug.
Therefore I can’t use this.store.findRecord() or this.store.peekRecord. The primary key in my backend models is the ID and for the moment, I don’t want to change this.
Instead I am using this in model hook (simpified just to use the slug in this case)
return this.store.query('someModelName',{
filter: {
slug: params.slug
}
}).then(function(result) {
return result.get("firstObject");
});
However, navigating between routes gives the same record back - the same model is always returned.
What I am doing wrong here? UPDATE - solved. I was not dealing with the Ember request on the backend (Django) correctly. Am now doing so - all good.
Using the default DS.JSONAPIAdapter.
Many thanks