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

Document.addRelation/removeRelation is documented but is not defined #439

Closed
simonratner opened this issue Feb 14, 2016 · 1 comment
Closed
Labels

Comments

@simonratner
Copy link
Contributor

Documented here:
http://thinky.io/documentation/api/document/#addrelation
http://thinky.io/documentation/api/document/#removerelation

Either the implementation was removed but docs never updated, or it was planned but never implemented. Easy enough to patch in:

Document.prototype.addRelation = function (field, joinedDoc) {
  let model = this.getModel()
  let pk = this[model._pk]
  return model.get(pk).addRelation(field, joinedDoc)
}

Document.prototype.removeRelation = function (field, joinedDoc) {
  let model = this.getModel()
  let pk = this[model._pk]
  return model.get(pk).removeRelation(field, joinedDoc)
}
@neumino
Copy link
Owner

neumino commented Feb 22, 2016

Ah thanks, I think I just forgot to actually implement it, but like you said it's pretty straightforward.

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

No branches or pull requests

2 participants