-
-
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
Polymorphic Pattern via (seemingly arbitrary) Mixin w/ JSONAPI #3919
Comments
You have to have either a model or a mixin when using polymorphic types. See here for the current implementation. |
Yup - I understand (and quite like) the "official" pattern. Just seems like a stumbling block that the In the above case, does the "dummy mixin" actually do anything? Again - I may be missing something. |
In this case the |
Thanks dudes! Again - I'm more highlighting that it's a little confusing there's no check to ensure the Mixin is actually applied to the "polymorphic" Model ( Feels arbitrary that a Mixin even has to exist here. Just wanted to let you know it may be confusing for beginners! |
I'm going to close this as it's working as intended by not applying the mixin – it just has to exist. In #4375 we're tracking the improvement of docs around polymorphic relationships. |
thanks @wecc ! |
Hi All!
Apologies if this has been resolved, but seeing as I'm on Ember Data
1.13.9
I thought I'd report this.I'm working on some basic polymorphic stuff with Active Model Serializers
0.10.0.rc2
, and its JSONAPI Adapter.I'm used to the "Mixin" pattern for Polymorphism in Ember, however I've noticed that this works without any hitches:
In the case above,
recap.js
does not haveStatisticable
mixed in. It simply requires thatmixin:statisticable
exists on the container, and doesn't check that it's mixed into the class Polymorphic class.Without the mixin existing, ED complains that there's no model called
statisticable
.So it seems like the requirement for there to be a
mixin:statisticable
is kinda arbitary? Or am I missing something?The text was updated successfully, but these errors were encountered: