I am trying to figure out a way to create dynamic model types, stored in their own respective collections (for a CMS). I want to be able to define a new "content type" and have it stored in it's own collection, and use a standard Sails model to control each model.
I am trying setting the tableName
before saving and before fetching, however with no success.
So something like this:
(Model) Content:
- id
- createdDate
- contentType
- {n...fields}
(Model) ContentType:
- id
- collection (to which each content object would store)
- name
- fields
- field{n}
- type
- name
- required
- …
I am just not sure how to make that happen in sails.js/waterline
This is not possible, at least not the way I am hoping to do it, according to the Sails GitHub page:
https://github.com/balderdashy/sails/issues/1160
Bummer! If someone has a good solution though, let me know and I will mark it as the solution :)