-
Notifications
You must be signed in to change notification settings - Fork 185
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
Not all prefix parameters specified #166
Comments
I've got this problem as well. I can't work out how to add records that have a belongs_to relationship defined in the class. |
Yep, even in the more simple case of Content belongs_to ContentType, I can include the :content_type_id in my created Content < JsonApiClient::Resource object, and it will correctly route to Either it creates params like |
Same issue for me when I use polymorphic association. |
Is there any solution or workaround for this please? We used to use an early version of the gem (1.1.1) and we didn't have any issues. After upgrading to 1.5.3 we started seeing this "Not all prefix parameters specified" issue when trying to update a child resource. |
Hi @egoholic @JohnSmall @Genkilabs @Hitesh-bigscal @adamdullenty I've reproduced your issue on version 1.5.3, but in 1.6.0 fixed class TestResource < JsonApiClient::Resource
self.site = "http://example.com/"
def self.key_formatter
JsonApiClient::DasherizedKeyFormatter
end
def self.route_formatter
JsonApiClient::UnderscoredKeyFormatter
end
end
class MultiWordParent < Formatted
end
class MultiWordChild < Formatted
belongs_to :multi_word_parent
end
class BelongsTo < MiniTest::Test
def test_belongs_to_urls_create_record
stub_request(:post, 'http://example.com/multi_word_parents/1/multi_word_children').
with(headers: { content_type: 'application/vnd.api+json', accept: 'application/vnd.api+json' }, body: {
data: {
type: 'multi_word_children',
attributes: {
foo: 'bar',
'multi-word-field': true
}
}
}.to_json)
.to_return(headers: { content_type: 'application/vnd.api+json' }, body: {
data: {
id: '2',
type: 'multi_word_children',
attributes: {
foo: 'bar',
'multi-word-field': true
}
}
}.to_json)
record = MultiWordChild.new(multi_word_parent_id: 1, foo: 'bar', multi_word_field: true)
result = record.save
assert result
assert_equal('2', record.id)
end
end |
we have this issue fixed in to make it work in @Genkilabs in your case it could be something like: class BaseResource < JsonApiClient::Resource
self.site = "http://example.com/"
end
class ContentType < BaseResource
end
class Content < BaseResource
belongs_to :content_type
self.read_only_attributes = read_only_attributes + [:content_type_id]
end |
@egoholic you have a very strange case but if I think if you add |
I have relation
belongs_to
for all parent association but I got the "Not all prefix parameters specified" error when try to create/update entity. Could anyone explain how I should define associations to make POST request onentityAs/:entityA_id/entityBs/entityB_id/entityCs/entityC_id/entityDs
?Now for EntityD I have:
For now I can successfuly get EntityDs of EntityC, but I can't create or update them.
The text was updated successfully, but these errors were encountered: