-
-
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
Adjust code samples to ember-cli #3174
Conversation
@@ -8,8 +8,10 @@ | |||
Example | |||
|
|||
```javascript | |||
import DS from 'ember-data'; |
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.
Add // app/transforms/temperature.js
here?
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.
yep, good idea. done.
0f5f5a3
to
071990c
Compare
@@ -99,7 +102,7 @@ import BuildURLMixin from "ember-data/adapters/build-url-mixin"; | |||
property on the adapter: | |||
|
|||
```js | |||
App.ApplicationAdapter = DS.RESTAdapter.extend({ | |||
export default DS.RESTAdapter.extend({ |
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.
Maybe it's worth it to add the file name here too ?
@@ -251,7 +251,7 @@ export default Ember.Mixin.create({ | |||
endpoint of "/line_items/". | |||
|
|||
```js | |||
App.ApplicationAdapter = DS.RESTAdapter.extend({ | |||
export default DS.RESTAdapter.extend({ |
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.
// app/adapters/application.js
I think it should be in every example. Most people just look at the one api they are interested in instead of reading the whole page. |
@sly7-7 I felt like it might be too much visual clutter if we include it everywhere. It might also make people believe that this is only valid for the |
@Turbo87 It seems like you added it to all the snippets for serializers/embedded mixin, so for consistency, either we only have one per file, or one per snippets. |
We should look into the helper that the guides use to make their pretty file names and see if it needs to be added to the ember/website repo. |
paging @rwjblue |
Looks like the code is already on the website repo: emberjs/website@3bd5ef6 |
Looks like I spoke too soon the helper works but looks ugly. I've opened a pr to fix this: emberjs/website#2192. @Turbo87 Do you mind updating this pr to remove the all of the filename comments and replace the
->
|
d155bde
to
82f6067
Compare
firstName: attr('string'), | ||
lastName: attr('string'), | ||
birthday: attr('date') | ||
}); | ||
|
||
var attributes = Ember.get(App.Person, 'attributes') | ||
var attributes = Ember.get(Person, 'attributes') |
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 sure what to do in those cases, where we consume the class.
Either use the app/models/person.js
header, either replace the class declaration by an import statement like import Person from app/models/person
?
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.
done
|
||
App.Person = DS.Model.extend({ | ||
var Person = DS.Model.extend({ |
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.
@sly7-7 the problem is the Ember.get()
call below. I'm not sure how this is supposed to work with ember-cli now. Is there something similar that could replace it?
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 think you could still do
import Ember from 'ember'
then call the Ember.get()
@bmac c/d ?
Well, this probably needs someone else eyes, but LGTM |
ember-cli is the recommended way of doing things now and should have priority
var attr = DS.attr; | ||
var hasMany = DS.hasMany; | ||
var belongsTo = DS.belongsTo; | ||
// app/models/blog-post.js |
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.
Lets move this to the header.
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.
Ah nevermind this is the README.md
.
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.
do you mean ```app/models/blog-post.js
? that won't work here since it will be rendered by GitHub, not the website.
Looks good @Turbo87 🎉 |
cool, thanks for merging! |
I'm adjusting the samples to match the blueprints of the
ember-cli
tool as discussed in #3139.Closes #3155