javascript - Backbone ID attribute is different than the parameter I need for the API -
i'm using backbone collections , models api. id attribute default id attribute mongo (_id) in api, use different unique key single model. slug unique.
the problem when want save(), put
request instead of post
because assumes there model key (slug) because user able enter slug himself (with proper validations of course).
is there way can 'say': "ok, idattribute _id
want use slug
when fetching data?
well, got working doing following:
var page = new pagemodel({_id: param}); // no idea why works tbh page.fetch();
have no idea why works since model _id
not equal param
i'm giving somehow finds correct model anyway.
Comments
Post a Comment