Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fetching individual models #10

Open
dominicglenn opened this issue Jul 23, 2012 · 0 comments
Open

fetching individual models #10

dominicglenn opened this issue Jul 23, 2012 · 0 comments

Comments

@dominicglenn
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant