我遇到的情况是响应为空:
#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结构。这是正常行为吗?
根据{{3}}:
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.