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

[BUGFIX beta] Overhaul attr/relationships imports in model blueprint #4331

Merged
merged 1 commit into from
Apr 15, 2016
Merged

[BUGFIX beta] Overhaul attr/relationships imports in model blueprint #4331

merged 1 commit into from
Apr 15, 2016

Conversation

pangratz
Copy link
Member

When a model is generated via ember generate model without attributes
and relationships, then it is not immediately clear from the generated
blueprint, on how to add attributes and relationships via importing
stuff from the modules.

This change adds the imports as comments, so uncommenting allows to
quickly add the imports without writing the import statement. So the
command ember genrate model foo now creates this file:

import Model from "ember-data/model";
// import attr from "ember-data/attr";
// import { belongsTo, hasMany } from "ember-data/relationships";

export default Model.extend({
});

This has been raised in the #-ember-data slack channel, where it was confusing on how to add attributes and relationships, since there is no import DS from "ember-data" in the generated file anymore, and it is not immediately clear where attr, belongsTo and hasMany are imported from.

When a model is generated via `ember generate model` without attributes
and relationships, then it is not immediately clear from the generated
blueprint, on how to add attributes and relationships via importing
stuff from the modules.

This change adds the imports as comments, so uncommenting allows to
quickly add the imports without writing the import statement. So the
command `ember genrate model foo` now creates this file:

```js
import Model from "ember-data/model";
// import attr from "ember-data/attr";
// import { belongsTo, hasMany } from "ember-data/relationships";

export default Model.extend({
});
```
@bmac
Copy link
Member

bmac commented Apr 15, 2016

Looks good. 👍

@bmac bmac merged commit 9a5e796 into emberjs:master Apr 15, 2016
@pangratz pangratz deleted the manage-model-modules branch April 18, 2016 09:42
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.

2 participants