0

I've created a selfreferential model in sails and when I try to create some items it works. But when I get to the findAll() method it returns me an empty array. I don't suppose it is a bug because I might failed with creating a selfreferential model. Anyway, if this model is correct, how can I trace when the Sails.js fails at getting items? For creating and getting I use auto routes created by sails (/:controller/:action)

My model (Category):

attributes: {
    name: {
        type: 'string',
        required: true,
        notEmpty: true
    },
    parentCategory: {
        model: 'Category',
        defaultsTo: null
    },
    subCategories: {
        collection: 'Category',
        via: 'parentCategory',
        defaultsTo: []
    },
    products: {
        collection: 'Product',
        via: 'categories',
        defaultsTo: []
    }

}
Nik
  • 133
  • 3
  • 9
  • about to try something similar, and will update this question if i arrive at a solution. Where did you get with this problem, did you solve it yourself? – arcseldon Sep 19 '14 at 17:44
  • No, I've dropped sails.js and switched to Express.js + Mongoose – Nik Mar 26 '15 at 13:15

0 Answers0