I sometime use the serializer to render the reply from some API request like below.
In controller
result = Hoge.find(1)
resource = Object.const_get('HogeResource')
serializer = JSONAPI::ResourceSerializer.new('HogeResource')
body = serializer.serialize_to_hash(resource.new(result, nil))
render json: body, status: 20
and the result is
http://localhost:3000/hoges/1
{
"data": {
"id": "1",
"type": "hoges",
"links": {
"self": "/hoges/1"
},
"attributes": {
self should have the hostname like http://localhost:3000/amc/hoges/1
Any idea how to fix this?
I sometime use the serializer to render the reply from some API request like below.
In controller
and the result is
http://localhost:3000/hoges/1selfshould have the hostname likehttp://localhost:3000/amc/hoges/1Any idea how to fix this?