Search code examples
arraysmodelpushderbyjs

How to use Derby.js model arrays?


I keep getting Fatal error: [object Object] is not an Array and then a server crash, whenever I try to use Derby.js/Racer's model array methods, (push, insert) for example.

app.ready (model)->
   model.set 'list', []
   model.push 'list', 'test'

Solution

  • https://github.com/codeparty/racer/issues/71

    The root model has to an object. So the below would work.

    app.ready (model)->
        model.set 'list.list', []
        model.push 'list.list', 'test'