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

Polymorphic fragmentArray and typeKey #468

Open
basz opened this issue Jun 20, 2023 · 1 comment
Open

Polymorphic fragmentArray and typeKey #468

basz opened this issue Jun 20, 2023 · 1 comment

Comments

@basz
Copy link
Contributor

basz commented Jun 20, 2023

Hi

I used to be able to do this on a polymorphic model to get to the typekey given as argument in the model definition

const typeKey = this.contactModel.get('options.typeKey');

Currently (6.0.1) these event options is undefined. Did ember data remove that? I'm still using ember and ember-data 3.28.12

@fragmentArray('fragment/contact/contactcomponent', {
    polymorphic: true,
    typeKey: 'componentType',
    ...
@dwickern
Copy link
Contributor

dwickern commented Feb 8, 2024

In model-fragments v5, FragmentArray exposed an options property containing the attribute metadata, although it was private API:

In model-fragments v6, you can get a fragment array's attribute metadata the same way you would do for any regular attr:

So you could do something like:

modelInstance.constructor.attributes.get('fragmentArrayAttr').options

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