{"action":"created","issue":{"url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1056","labels_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1056/labels{/name}","comments_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1056/comments","events_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1056/events","html_url":"https://github.com/rails-api/active_model_serializers/issues/1056","id":101221752,"number":1056,"title":"Serializer with relationship serializer not working with json_api adapter","user":{"login":"thecritic","id":3063603,"avatar_url":"https://avatars.githubusercontent.com/u/3063603?v=3","gravatar_id":"","url":"https://api.github.com/users/thecritic","html_url":"https://github.com/thecritic","followers_url":"https://api.github.com/users/thecritic/followers","following_url":"https://api.github.com/users/thecritic/following{/other_user}","gists_url":"https://api.github.com/users/thecritic/gists{/gist_id}","starred_url":"https://api.github.com/users/thecritic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thecritic/subscriptions","organizations_url":"https://api.github.com/users/thecritic/orgs","repos_url":"https://api.github.com/users/thecritic/repos","events_url":"https://api.github.com/users/thecritic/events{/privacy}","received_events_url":"https://api.github.com/users/thecritic/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-08-16T00:31:04Z","updated_at":"2015-08-17T14:59:47Z","closed_at":null,"body":"I am trying to use custom serializers in my relationship, and they seem to work with the custom adapter, however, when I specify the json_api adapter in an initializer, they stop to work. \r\n\r\nHere is my serializer: \r\n\r\n    module Api\r\n      module V1\r\n        module Serializers\r\n          class PostSerializer < ActiveModel::Serializer\r\n            attributes :title, :id\r\n\r\n            belongs_to :author, serializer: UserSerializer\r\n            has_many :post_sections, serializer: PostSectionSerializer\r\n          end\r\n        end\r\n      end\r\n    end\r\n\r\nWhen I use the json_api adapter the relationships return empty data sets (just id and type attributes), when I use the default adapter everything works fine. Is that a bug or am I not getting something ? \r\n\r\nEDIT: SO question: http://stackoverflow.com/questions/32036253/active-model-serializer-not-working-with-json-api-adapter"},"comment":{"url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/comments/131854202","html_url":"https://github.com/rails-api/active_model_serializers/issues/1056#issuecomment-131854202","issue_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1056","id":131854202,"user":{"login":"joaomdmoura","id":667063,"avatar_url":"https://avatars.githubusercontent.com/u/667063?v=3","gravatar_id":"","url":"https://api.github.com/users/joaomdmoura","html_url":"https://github.com/joaomdmoura","followers_url":"https://api.github.com/users/joaomdmoura/followers","following_url":"https://api.github.com/users/joaomdmoura/following{/other_user}","gists_url":"https://api.github.com/users/joaomdmoura/gists{/gist_id}","starred_url":"https://api.github.com/users/joaomdmoura/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joaomdmoura/subscriptions","organizations_url":"https://api.github.com/users/joaomdmoura/orgs","repos_url":"https://api.github.com/users/joaomdmoura/repos","events_url":"https://api.github.com/users/joaomdmoura/events{/privacy}","received_events_url":"https://api.github.com/users/joaomdmoura/received_events","type":"User","site_admin":false},"created_at":"2015-08-17T14:59:46Z","updated_at":"2015-08-17T14:59:46Z","body":"So @thecritic, this is the expected behavior, because it follows the json-api conventions, as you can see by the chain bellow, it does not support an `attributes` key.\r\n\r\n> - relationships: a **relationships object** describing relationships between the resource and other JSON API resources.\r\n\r\n> A **relationship object** MUST contain at least one of the following:\r\n...\r\n- data: **resource linkage**\r\n\r\n> **Resource linkage** MUST be represented as one of the following:\r\n...\r\n- A \"resource identifier object\" MUST contain `type` and `id` members.\r\n\r\nI know it might seems an overkill, but the idea is to force you to keep it simple. I honestly don't think it's an overkill if you need it, because the `id` and `type` on the `relationships` represents simplest image of the object you are retrieving and it's associations."}}