Skip to content

fetching individual models #10

@dominicglenn

Description

@dominicglenn

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions