Hello. I have the folowing situation:
model: Rol {id, description}
model: User {name, code, status} asociated with Rol (User hasMany Rol)
When I load the object User (that automatically fetch Rols) I have something like this:
User: {id: 1, name: "asdasd", code: "asdasd", status: 1, rols: [{id: 1, description: "rol 1"}]}
When I create a new object: User.create([model], function ....)
It generates an insert statement like this:
INSERT INTO user (code, name, status, rols) VALUES ('asdasd', 'asdasd', 0, (id = 2, descripcion = 'Supervisor'))
So the problem is that is trying to insert rols directly into thr user...
Im doing something wrong?
Thanks.
Hello. I have the folowing situation:
model: Rol {id, description}
model: User {name, code, status} asociated with Rol (User hasMany Rol)
When I load the object User (that automatically fetch Rols) I have something like this:
User: {id: 1, name: "asdasd", code: "asdasd", status: 1, rols: [{id: 1, description: "rol 1"}]}
When I create a new object: User.create([model], function ....)
It generates an insert statement like this:
INSERT INTO
user(code,name,status,rols) VALUES ('asdasd', 'asdasd', 0, (id= 2,descripcion= 'Supervisor'))So the problem is that is trying to insert rols directly into thr user...
Im doing something wrong?
Thanks.