Skip to content

Problem with create and relartions #178

Description

@maxsosa

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions