[OCTANE] migrate a few other ember data examples#603
Conversation
mike-north
left a comment
There was a problem hiding this comment.
Everything else looks good!
|
|
||
| export default class RentalModel extends Model { | ||
| @attr title; | ||
| @attr owner; |
There was a problem hiding this comment.
Ember-data decorators were mentioned but not listed in the API changes for emberjs/rfcs#408. I pinged @igorT to confirm (he's investigating) that this is (a) supported and (b) something we want to steer people towards.
cc: @pzuraq
There was a problem hiding this comment.
cc: @mike-north thanks for fact checking this. I had opened another issue related to this. pzuraq gave some insight in this comment: #554 (comment)
There was a problem hiding this comment.
I double checked with @runspired and it's supported and people should use it
There was a problem hiding this comment.
Yup, @mike-north this is actually not an @ember-decorators feature, it's a natural side effect of the fact that we support computed property macros in RFC 408. DS.attr is a computed property macro, as are most cool Ember helpers/features throughout the ecosystem, so they are all automatically decorators 😄
There was a problem hiding this comment.
Oh, one thing that does need to change here though, I'm pretty sure you'll still have to do @attr() here, since these are functions that return decorators, and are not decorators themselves. Bit of a pain, but this will be the case until the ecosystem updates to support paren-less invocations.
|
|
||
| Let's define the structure of a rental object using the same attributes for our rental that we [previously used](../model-hook/) in our hard-coded array of JavaScript objects - | ||
| _title_, _owner_, _city_, _category_, _image_, _bedrooms_ and _description_. | ||
| Define attributes by giving them the result of the function [`DS.attr()`](https://www.emberjs.com/api/ember-data/release/classes/DS/methods/attr?anchor=attr). |
There was a problem hiding this comment.
Can you update the prose to check for other references to the method DS.attr()?
There was a problem hiding this comment.
I updated each reference to attr as well as other references using DS.something
Finish #543
@acorncom this should wrap up the few strictly ember data sections I had recalled. #594 covers the testing section that had some ember data examples as well.