I have two models that we'd like to be created in the same request.
Resource
module API
module V1
class ProjectToolboxTalkResource < JSONAPI::Resource
attributes :date
has_one :toolbox_talk
has_one :superintendent
has_one :project
has_many :attendees
has_many :project_toolbox_talk_users
end
end
end
POST Request
{
"data": {
"type": "project_toolbox_talks",
"attributes": { "date": "2017-12-11" },
"relationships": {
"project_toolbox_talk_users": {
"data": [
{
"type": "project_toolbox_talk_users",
"attributes": { "user_id": "559ff2c9-beb6-47cd-9757-66104617403b" }
}
]
},
"projects": {
"data": {
"type": "projects", "id": "d9b28ffd-6f30-4dd0-a227-720caa9b881e"
}
}
}
}
}
When I make the POST request I get the following error even though I have linked project with has_one :project
{
"errors": [
{
"code": "105",
"detail": "projects is not allowed.",
"status": "400",
"title": "Param not allowed"
}
]
}
What am I not understanding?
I have two models that we'd like to be created in the same request.
Resource
POST Request
When I make the POST request I get the following error even though I have linked project with
has_one :projectWhat am I not understanding?