{"action":"created","issue":{"url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1127","labels_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1127/labels{/name}","comments_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1127/comments","events_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1127/events","html_url":"https://github.com/rails-api/active_model_serializers/pull/1127","id":105244477,"number":1127,"title":"Support nested associations for json adapter","user":{"login":"NullVoxPopuli","id":199018,"avatar_url":"https://avatars.githubusercontent.com/u/199018?v=3","gravatar_id":"","url":"https://api.github.com/users/NullVoxPopuli","html_url":"https://github.com/NullVoxPopuli","followers_url":"https://api.github.com/users/NullVoxPopuli/followers","following_url":"https://api.github.com/users/NullVoxPopuli/following{/other_user}","gists_url":"https://api.github.com/users/NullVoxPopuli/gists{/gist_id}","starred_url":"https://api.github.com/users/NullVoxPopuli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NullVoxPopuli/subscriptions","organizations_url":"https://api.github.com/users/NullVoxPopuli/orgs","repos_url":"https://api.github.com/users/NullVoxPopuli/repos","events_url":"https://api.github.com/users/NullVoxPopuli/events{/privacy}","received_events_url":"https://api.github.com/users/NullVoxPopuli/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-09-07T16:34:52Z","updated_at":"2015-09-11T08:27:48Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1127","html_url":"https://github.com/rails-api/active_model_serializers/pull/1127","diff_url":"https://github.com/rails-api/active_model_serializers/pull/1127.diff","patch_url":"https://github.com/rails-api/active_model_serializers/pull/1127.patch"},"body":"Originally #1114 (I messed up the history because I merged instead of rebased)\r\n\r\nThis PR is based off of #1111, cause I needed the refactoring.\r\n\r\nDiscussion of idea here: #1113\r\n\r\nRelates to:\r\n#921\r\n#1073\r\n\r\nBasically:\r\n\r\n```ruby\r\nBlogSerializer < #...\r\n  has_many :posts, include: { author: [:bio], comments: [:author]] }\r\nend\r\n```\r\nresulting json may look like:\r\n\r\n```\r\n{\r\n  blog: {\r\n    posts: [\r\n      {\r\n        author: {\r\n          bio: {...}\r\n        },\r\n        comments: [\r\n          {  author: {...} }\r\n        ]\r\n      }\r\n    ]\r\n  }\r\n}\r\n```\r\n\r\nSee the included tests for more examples."},"comment":{"url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/comments/139483990","html_url":"https://github.com/rails-api/active_model_serializers/pull/1127#issuecomment-139483990","issue_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1127","id":139483990,"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-09-11T08:27:48Z","updated_at":"2015-09-11T08:27:48Z","body":"Hey @NullVoxPopuli finally checking this for real! Look awesome and great! There are some room for improvement but most of thing were already mentioned.\r\n\r\nI merged the Adapter PR from Benjamin so you can already rebase yours and update it to use any new feature he might have added that would help you.\r\n\r\nAfter review this I had some ideas, I don't think it need to be implemented on this PR but it's something we would need on 0.10.x. About [this](https://github.com/rails-api/active_model_serializers/pull/1127#discussion_r39249565) specifically: \r\n\r\nAs I mentioned on the comment above, right now we have an `include` options on render that handles nested association on json-api. This PR implements a `include` option on the association declaration that also handles nested associations.\r\nWould be awesome if we could use both `include`s in both adapters, so you can handle nested association on json-api and json/flatten_json with the same way enabling you to define it on the serializer os specify on a `render` call."}}