Closed dcolley closed 9 years ago
This has similarities to what I have asked here: http://stackoverflow.com/questions/26837605/associations-with-combination-foreign-key-in-sails-js-waterline.
Having also come from Yii, I am used to being able to structure my data this way. I want to have a common association across multiple models - with a single join table OR a combination PK - the table name (or 'Type') and the ID. There's no way to define this in waterline syntax that I have been able to find.
Currently there's no way to create this sort of association using waterline. If you think this is a missing feature, feel free to raise a feature request over on the waterline repo. For the time being, I would suggest adding a custom model method rather than an attribute.
I'm porting our api from yii to sails.js. In the Yii model for "Project" I have a 'relation' to "Comment" as follows:
How can I model this in sails.js?
I have created a model attribute function
... but it should be possible via associations... :/ Is there any documentation on this?