-
-
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 HasManyReference #4642
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.
❤️ ❤️ ❤️
comments: DS.hasMany({ async: true }) | ||
}); | ||
|
||
var post = store.push({ |
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.
not a valid format for store.push
comments: DS.hasMany({ async: true }) | ||
}); | ||
|
||
var post = store.push({ |
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.
not a valid format for store.push
@@ -46,10 +150,85 @@ HasManyReference.prototype.ids = function() { | |||
}); | |||
}; | |||
|
|||
/** | |||
The link Ember Data will use to fetch or reload this belongs-to |
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/belongs-to/has-many
comments: DS.hasMany({ async: true }) | ||
}); | ||
|
||
var post = store.push({ |
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.
not a valid format for store.push
comments: DS.hasMany({ async: true }) | ||
}); | ||
|
||
var post = store.push({ |
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.
not a valid format for store.push
|
||
var commentsRef = post.hasMany('comments'); | ||
|
||
commentsRef.value() === post.get('comments') |
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.
This code sample is not completely accurate. We should either make the relationship sync, or resolve the post.get("comments")
and state that the resolved value is commentsRef.value()
.
I would prefer the promise version to indicate that references allow you synchronous access to an async relationship.
comments: DS.hasMany({ async: true }) | ||
}); | ||
|
||
var post = store.push({ |
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.
not a valid format for store.push
comments: DS.hasMany({ async: true }) | ||
}); | ||
|
||
var post = store.push({ |
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.
not a valid format for store.push
@@ -34,10 +77,71 @@ HasManyReference.prototype.remoteType = function() { | |||
return "ids"; | |||
}; | |||
|
|||
/** | |||
The link Ember Data will use to fetch or reload this belongs-to |
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/belongs-to/has-many
``` | ||
|
||
@method link | ||
@return {String} The link Ember Data will use to fetch or reload this belongs-to 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/belongs-to/has-many
d5b2d30
to
9cd5541
Compare
|
||
Example | ||
|
||
```javascript |
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.
Can you split into
```app/models/post.js
```
and
```javascript
```
please?
9cd5541
to
00b664a
Compare
6ced946
to
dfa365c
Compare
dfa365c
to
ae7e8ab
Compare
Thank much @bmac |
No description provided.