I'm using sails with postgresql and I have a user with an array of group ids. I want to save the group id in the user table. my user model is like:
module.exports = {
attributes: {
first_name: {
type: 'string'
},
last_name: {
type: 'string'
},
company: {
type: 'string'
},
password: {
type: 'string',
minLength: 6,
required: true,
columnName: "password"
},
user_groups: {
model: 'groups',
}
}
but when I send a request like [2] I get the error of :
Could not use specified
user_groups. Expecting an id representing the associated record, ornullto indicate there will be no associated record. But the specified value is not a validuser_groups. Instead of a number (the expected pk type), got: [ 2 ]