Backbone.Relational.store
#450

Comments

So, i had many issues like "duplicate id" and i was fixing it by finding cached models in the store.
But now i know why this is wrong... My models can come from different source, like:

/users/:id/assets
/pages/:id/assets

So there is a problem if i get asset from store and delete it, what asset do i deleting?
The last one cached! It's wrong...
So either store should test uniquness by id and url
Or i should disable caching all together...

Sounds like the issue here is with your data. If these models are actually different entities, why are you using the same Backbone model? And if that is actually the desired behavior, why are their ids overlapping if they are different entities? Shouldn't you be using full resource_uri's as ids then?

It's the same model, but in different places identified by URL...
It's not a different model, or a submodel.. it's absolutely the same model but on different urls
So if i have assets model on "/users/1/assets/1" and the same model on "/users/2/assets/1" i want my delete methods to go to the respective urls and not on the firs one loaded!

It's a nested resources nothing special!
UPDATE:
Ok, i'm not exposing join table ids... but they can overlap too... so it's not a cure to this issue!
UPDATE2:
Ok, maybe if i expose the join tables as api enpoints, and create it as standalone models, then it can work? i think =\