javascript - Passing urls to relational collections in backbone -
i'm using backbone relational , it's great. problem have run when need backend provide url models attach to.
this isn't such problem when using one-to-one relationships because model can hold onto url attribute of itself.
the collection on other hand creates separate model within itself.
what best way bind these together. examples below
{ "user": { "url": "http://example.com/api/user/1" }, "permissions": { "url": "http://example.com/api/user/1/permissions" } }
in above example, want user model url provided, , permissions collection, url provided.
what have tried collection working following:
{ "permissions": { "url": "https://example.com/api/user/1/permissions" "data": [] } }
but wasn't able run parse extracts variables out.
if have not set {parse: true}
on relation definition (documentation), should so, , see if fixes problem. otherwise, if provided more code.