Skip to content
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

Modelarray.from #330

Open
eperiou opened this issue Apr 10, 2017 · 0 comments
Open

Modelarray.from #330

eperiou opened this issue Apr 10, 2017 · 0 comments

Comments

@eperiou
Copy link

eperiou commented Apr 10, 2017

So I had a problem when trying to input an array of objects. The ModelArray.from(arr) command does make a model array, but it did not make a model array of models. Which I forced into working by forEaching and setting each object individually with Model.create(obj). But with this I needed to set a foreign key on each item of the array. I was trying to use setAll(field,value) but the error comes up that setAll was not a function.
On top of this, the Model.create(obj).set(field, value) did not function as expected either. So I needed to use an impure function to update each element of my original array, update their keys, and then model.create() each one, to insert them into the database.
Was there something that I was doing wrong? or something i was missing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant