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
Requesting Help with Polymorphic Relationship #772
Comments
Based on the information you've provided (thanks!) and if I'm understanding your issue correctly, I'm not able to reproduce your issue. See this repro. Can you provide a reproduction to give visibility of your issue? |
Thank you for your help Cuebit. After reading your message, I tried a few other things. I build a form to enter the data into the database, and this solved the problem. Previously, I had hand-keyed in the change of the name of the likeable_type, and somehow this was not recognized by Vuex-ORM. |
@danielkirkland glad you found a solution. Keep winning 👍 |
Hi Cuebit, would it be possible that you could help me out with a different problem. import { Model } from '@vuex-orm/core' import { Model } from '@vuex-orm/core' If you have any recommendations, I would be very appreciative. |
Ordering is done on retrieval. Since the For example: const propositions = Propositions.query().with('likes').get().sort((a, b) => {
return a.likes.length < b.likes.length ? -1 : a.likes.length > b.likes.length ? 1 : 0
}) |
Hello! At the outset, I must say that Vuex-ORM is fabulous! Thank you for all of your work on this.
I have a problem, and I would be very appreciative if someone would be able to help me out.
The problem is with creating new data of a One to Many Polymorphic relationship.
I have 3 tables, two of which are listed here (propositions and likes):
And
There is a database/index.js:
And I have data coming from the API:
I have made a change on the backend so that the likeable_type is in agreement with the documentation for Vuex-ORM. However, when the
Proposition:create
is triggered, the propositions table and users table are populated. However, the likes table, which has a polymorphic one-to-many relationship with proposition does not.Is there something incorrect in what I have done, or is there a way in which the data could be passed to the polymorphic relation?
Thank you for any guidance that could be offered.
Daniel
The text was updated successfully, but these errors were encountered: