Instantiating same ID with the same class #305

fertapric opened this Issue Mar 21, 2013 · 2 comments

2 participants


Hi all,

I'm able to instantiate more than one object of the same type with the same ID. I attach the screenshot:

Screen Shot 2013-03-21 at 19 30 17

This happens when I fetch a collection of "Snippets" and after that I fetch one of the objects using a new Snippet object.

To give more context, the API I'm using looks like Twitter API, and API calls look like:

List collection of Snippets: /snippets/created/by/:user_id
Detail of snippet: /snippets/show/:snippet_id

So, to get the information of a Snippet:

new Snippet({ _path: 'show/' + }).fetch({
  success: function(model, response) {

I was expecting that once the server return the same Snippet object, a new object wouldn't be created, but the result is that a new object is added to the collections.

I saw that I can "solve" the problem using something like this:

var snippet = Snippet.findOrCreate( || new Snippet();
snippet._path = 'show/' +;
  success: function(model, response) {

but I thought it would be nice to report this.


Looks like what you're doing is similar to #295 ? Create an "empty" model, then set the id?


Exactly. I will follow up the other issue.

@fertapric fertapric closed this Mar 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment