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

Add API docs for the HasManyReference #4642

Merged
merged 1 commit into from Nov 30, 2016

Conversation

bmac
Copy link
Member

@bmac bmac commented Nov 11, 2016

No description provided.

Copy link
Member

@pangratz pangratz left a 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({
Copy link
Member

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
Member

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
Copy link
Member

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
Member

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
Member

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
Member

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
Member

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
Member

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
Copy link
Member

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
Member

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


Example

```javascript
Copy link
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 3 times, most recently from 6ced946 to dfa365c Compare November 21, 2016 13:24
@bmac
Copy link
Member Author

bmac commented Nov 21, 2016

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

@pangratz pangratz merged commit 8c9ea44 into emberjs:master Nov 30, 2016
@pangratz
Copy link
Member

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.

None yet

3 participants