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

Fixed modelFor documentation. Look up model's class name #4693

Merged
merged 2 commits into from
Mar 8, 2017
Merged

Fixed modelFor documentation. Look up model's class name #4693

merged 2 commits into from
Mar 8, 2017

Conversation

maartenparmentier
Copy link
Contributor

Represents the model's class name as a string. This can be used to look up the model's class name through DS.Store's modelFor method.

This is wrong and should be model's class name since you don't look up the actual model but the name.

```Represents the model's class name as a string. This can be used to look up the model's class name through DS.Store's modelFor method.```

This is wrong and should be `model's class name` since you don't look up the actual model but the name.
@@ -995,7 +995,7 @@ Model.reopenClass({
},

/**
Represents the model's class name as a string. This can be used to look up the model through
Represents the model's class name as a string. This can be used to look up the model's class name through
DS.Store's modelFor method.
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 wrap DS.Store in a code fence while you're in there? Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@locks done!

Represents the model's class name as a string. This can be used to look up the model through
DS.Store's modelFor method.
Represents the model's class name as a string. This can be used to look up the model's class name through
`DS.Store`'s modelFor method.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, so I can see how the original documentation is somehow misleading. In ember-data a model basically means the class (something which extends DS.Model) and a record means an instance of a model (created via store.createRecord).

store.modelFor returns the class for the given name.

So what do you think of rephrasing the whole line into something like:

Represents a model's class name as a string, which can be used to lookup the class itself via DS.Store's modelFor method.

Not sure if that is actually better though. Just wanted to highlight that store.modelFor returns the class. Hope that helps.

@pangratz
Copy link
Member

pangratz commented Dec 5, 2016

Thanks for helping out making the docs more clear @maartenparmentier! ❤️

@stefanpenner stefanpenner merged commit a90de0d into emberjs:master Mar 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants