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

don't override the default idAttribute #41

Open
Lacrymology opened this issue Nov 13, 2013 · 1 comment
Open

don't override the default idAttribute #41

Lacrymology opened this issue Nov 13, 2013 · 1 comment

Comments

@Lacrymology
Copy link

if there's a good reason for this, it can be disregarded, but why is the idAttribute option overriden instead of always just using the url() method?

in my use case, I've got an Option model with an Options collection, and I want to create a <select> with the options as <options>, and I end up with three ugly possibilities:

  • end up with a bunch of <option value="/api/v1/option/<id>"> which is semantically wrong
  • do <option value="<%= option.get("id") %>"> when <option value="<%= option.id %>"> would suffice and is more natural AND THEN I've got to do collection.find(function(x) { return x.get('id') == id }) instead of just collection.get(id)
  • set idAttribute: "id" in all of my models.. which means explicitly set things back to default.

With the current url() override in https://github.com/PaulUithol/backbone-tastypie/blob/master/backbone_tastypie/static/js/backbone-tastypie.js#L102 this shouldn't be necessary

@Lacrymology
Copy link
Author

this is a duplicate for #20 I see

I would like to leave this open to discussion. What's the main argument to keep things as they are? It looks like the strongest argument here is "resource_uri is the only attribute that can be assumed to be present" bit in #20 (comment)

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