Closed
Description
Am I doing something wrong? I cannot seem to properly render a collection of objects. Looked across the documentation but could not find anything.. It looks really basic and this is what gets me confused..
results = [AddressFinder::AddressSearch::Result.new(a: "Some address", pxid: "qwe1", v: 1), AddressFinder::AddressSearch::Result.new(a: "Some other address", pxid: "qwe2", v: 1)]
render json: JSONAPI::Serializable::Renderer.new.render(
results,
class: { 'AddressFinder::AddressSearch::Result': AddressFinderSerializer }
)
class AddressFinderSerializer < JSONAPI::Serializable::Resource
type 'AddressFinder'
attribute :address do
@object.a
end
end
End Result:
{
'data' => [
{
'id' => '',
'type'=> 'AddressFinder',
'attributes' => {
'address' => 'Some address'
}
}
]
}
Expected result:
{
'data' => [
{
'id' => '',
'type'=> 'AddressFinder',
'attributes' => {
'address' => 'Some address'
}
},
{
'id' => '',
'type'=> 'AddressFinder',
'attributes' => {
'address' => 'Some other address'
}
}
]
}
Metadata
Metadata
Assignees
Labels
No labels