Skip to content

Add API docs for the HasManyReference - #4642

Merged
pangratz merged 1 commit into
warp-drive-data:masterfrom
bmac:doc-has-many-reference
Nov 30, 2016
Merged

Add API docs for the HasManyReference#4642
pangratz merged 1 commit into
warp-drive-data:masterfrom
bmac:doc-has-many-reference

Conversation

@bmac

@bmac bmac commented Nov 11, 2016

Copy link
Copy Markdown
Contributor

No description provided.

@pangratz pangratz left a comment

Copy link
Copy Markdown
Contributor

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({

Copy link
Copy Markdown
Contributor

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({

Copy link
Copy Markdown
Contributor

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

};

/**
The link Ember Data will use to fetch or reload this belongs-to

Copy link
Copy Markdown
Contributor

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({

Copy link
Copy Markdown
Contributor

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({

Copy link
Copy Markdown
Contributor

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')

Copy link
Copy Markdown
Contributor

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({

Copy link
Copy Markdown
Contributor

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({

Copy link
Copy Markdown
Contributor

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

};

/**
The link Ember Data will use to fetch or reload this belongs-to

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor

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

@bmac
bmac force-pushed the doc-has-many-reference branch from d5b2d30 to 9cd5541 Compare November 18, 2016 14:26

Example

```javascript

Copy link
Copy Markdown
Contributor

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?

@bmac
bmac force-pushed the doc-has-many-reference branch from 9cd5541 to 00b664a Compare November 18, 2016 14:39
@bmac
bmac force-pushed the doc-has-many-reference branch 3 times, most recently from 6ced946 to dfa365c Compare November 21, 2016 13:24
@bmac
bmac force-pushed the doc-has-many-reference branch from dfa365c to ae7e8ab Compare November 21, 2016 13:27
@bmac

bmac commented Nov 21, 2016

Copy link
Copy Markdown
Contributor Author

@locks @pangratz this pr has been rebased and updated.

@pangratz
pangratz merged commit 8c9ea44 into warp-drive-data:master Nov 30, 2016
@pangratz

Copy link
Copy Markdown
Contributor

Thank much @bmac

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants