-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add API docs for the RecordReference #4641
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯 ❤️
``` | ||
|
||
@method id | ||
@return {String} The id of the record in this belongsTo relationship. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/ in this belongsTo relationship.//
RecordReference.prototype.id = function() { | ||
return this._id; | ||
}; | ||
|
||
/** | ||
How the reference will be looked up with it is loaded: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...up with when it is loaded:... ?
/** | ||
How the reference will be looked up with it is loaded: | ||
|
||
* `link`, a URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I believe that this is not supported at the moment. At least I am not aware of this... What am I missing?
var userRef = store.getReference('user', 1); | ||
|
||
// provide data for reference | ||
userRef.push({ id: 1, username: "@user" }).then(function(user) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The data passed to push
needs to be a JSON-API doc with { data: { ... } }
RecordReference.prototype.push = function(objectOrPromise) { | ||
return Ember.RSVP.resolve(objectOrPromise).then((data) => { | ||
return this.store.push(data); | ||
}); | ||
}; | ||
|
||
/** | ||
If the entity referred to by the reference is already loaded, it is | ||
present as `reference.value`. Otherwise, the value of this property |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would change this to: Otherwise the value returned by this function is null
3e9a39c
to
717bdff
Compare
717bdff
to
4fc9133
Compare
@pangratz can you re-review? |
Thanks again @bmac |
No description provided.