You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I came across a case where I wanted to fetch an individual model given a certain id, the quickest and easiest way I thought of doing this would be assigned a new model a given id and then fetching it from the server. I changed the code to allow for this:
I added the following in the url function for the extended Backbone.Model.prototype:
if (this.get('id') !== undefined)
return url + this.get('id') + '/';
I'm not sure if people have come across this kind of thing before and would be interested in knowing if it should be done in a different way perhaps?
The text was updated successfully, but these errors were encountered:
I came across a case where I wanted to fetch an individual model given a certain id, the quickest and easiest way I thought of doing this would be assigned a new model a given id and then fetching it from the server. I changed the code to allow for this:
I added the following in the url function for the extended Backbone.Model.prototype:
I'm not sure if people have come across this kind of thing before and would be interested in knowing if it should be done in a different way perhaps?
The text was updated successfully, but these errors were encountered: