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

Update Fragment blueprint to use class instead of extend #379

Open
Gorzas opened this issue Oct 5, 2020 · 2 comments
Open

Update Fragment blueprint to use class instead of extend #379

Gorzas opened this issue Oct 5, 2020 · 2 comments

Comments

@Gorzas
Copy link
Contributor

Gorzas commented Oct 5, 2020

As Ember team is deprecating EmberObjects and it's recommending to use ES6 classes, I think we can update the Fragment blueprint to follow this syntax:

import MF from 'ember-data-model-fragments';

export default class <% name %> extends MF.Fragment {
 <% attrs %>
}

What do you think? I may leave a PR with my proposal.

Gorzas added a commit to Gorzas/ember-data-model-fragments that referenced this issue Oct 5, 2020
I know that the original blueprint uses this attribute to know what type
of Model will be used when creating them, but I don't know if it's a
good practice to use it in an Ember Addon.

I've created this commit to delete it in case it isn't necessary.

Related adopted-ember-addons#379
Gorzas added a commit to Gorzas/ember-data-model-fragments that referenced this issue Oct 5, 2020
@patocallaghan
Copy link
Contributor

patocallaghan commented Nov 5, 2020

@Gorzas I think this is a good idea. It might be worth doing to get it into the 5.0.0 beta release. It might also be better to use the specific Fragment import (similar to the updated Ember Data package imports)

import Fragment from 'ember-data-model-fragments/fragment';

export default class <% name %> extends Fragment {
 <% attrs %>
}

Gorzas added a commit to Gorzas/ember-data-model-fragments that referenced this issue Nov 6, 2020
Gorzas added a commit to Gorzas/ember-data-model-fragments that referenced this issue Nov 6, 2020
@Gorzas
Copy link
Contributor Author

Gorzas commented Nov 6, 2020

@patocallaghan Yes, I think it's better this way. Made the changes 😄.

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

No branches or pull requests

2 participants