active_model_serializer - сделать ноль - PullRequest
0 голосов
/ 20 февраля 2019

У меня есть ситуация, когда ответ нулевой:

#in a controller #show action

render json: @client.profile

У меня нет специальных настроек в ProfileSerializer, просто

class ProfileSerializer < ActiveModel::Serializer
  belongs_to :client
  attributes :id, ...#other attributes come here
end

В этом случае ответ простоnull, структура JSON отсутствует.Это нормальное поведение?Согласно Документам JSON API :

A server MUST respond to a successful request to fetch an individual 
resource with a resource object or null provided as the response document’s 
primary data.
...