{"action":"created","comment":{"url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/comments/41396530","id":41396530,"diff_hunk":"@@ -50,6 +50,10 @@ def self.type(type)\n       self._type = type\n     end\n \n+    def self.links(&block)\n+      self._links_block = block\n+    end","path":"lib/active_model/serializer.rb","position":6,"original_position":6,"commit_id":"9c5a9a35d171350b1527db4abdab5e627760e626","original_commit_id":"9c5a9a35d171350b1527db4abdab5e627760e626","user":{"login":"bf4","id":142914,"avatar_url":"https://avatars.githubusercontent.com/u/142914?v=3","gravatar_id":"","url":"https://api.github.com/users/bf4","html_url":"https://github.com/bf4","followers_url":"https://api.github.com/users/bf4/followers","following_url":"https://api.github.com/users/bf4/following{/other_user}","gists_url":"https://api.github.com/users/bf4/gists{/gist_id}","starred_url":"https://api.github.com/users/bf4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bf4/subscriptions","organizations_url":"https://api.github.com/users/bf4/orgs","repos_url":"https://api.github.com/users/bf4/repos","events_url":"https://api.github.com/users/bf4/events{/privacy}","received_events_url":"https://api.github.com/users/bf4/received_events","type":"User","site_admin":false},"body":"only if we design it this way.  simple solution is just pass in `links` to the adapter until we need more","created_at":"2015-10-07T14:27:59Z","updated_at":"2015-10-07T14:27:59Z","html_url":"https://github.com/rails-api/active_model_serializers/pull/1246#discussion_r41396530","pull_request_url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1246","_links":{"self":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/comments/41396530"},"html":{"href":"https://github.com/rails-api/active_model_serializers/pull/1246#discussion_r41396530"},"pull_request":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1246"}}},"pull_request":{"url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1246","id":46933416,"html_url":"https://github.com/rails-api/active_model_serializers/pull/1246","diff_url":"https://github.com/rails-api/active_model_serializers/pull/1246.diff","patch_url":"https://github.com/rails-api/active_model_serializers/pull/1246.patch","issue_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1246","number":1246,"state":"open","locked":false,"title":"Add support for resource-level JSON API links.","user":{"login":"beauby","id":2215778,"avatar_url":"https://avatars.githubusercontent.com/u/2215778?v=3","gravatar_id":"","url":"https://api.github.com/users/beauby","html_url":"https://github.com/beauby","followers_url":"https://api.github.com/users/beauby/followers","following_url":"https://api.github.com/users/beauby/following{/other_user}","gists_url":"https://api.github.com/users/beauby/gists{/gist_id}","starred_url":"https://api.github.com/users/beauby/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beauby/subscriptions","organizations_url":"https://api.github.com/users/beauby/orgs","repos_url":"https://api.github.com/users/beauby/repos","events_url":"https://api.github.com/users/beauby/events{/privacy}","received_events_url":"https://api.github.com/users/beauby/received_events","type":"User","site_admin":false},"body":"The syntax is as follows:\r\n```ruby\r\nclass PostSerializer < ActiveModel::Serializer\r\n  links do\r\n    link :self, href: \"http://api.domain.com/posts/#{object.id}\"\r\n  end\r\nend\r\n```\r\n\r\nNote that the `object` of the serializer instance is made available inside the `links` block.","created_at":"2015-10-06T17:37:12Z","updated_at":"2015-10-07T14:27:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2efa037ce7bf3c0798b86cb3487008004e57e6c9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1246/commits","review_comments_url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1246/comments","review_comment_url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1246/comments","statuses_url":"https://api.github.com/repos/rails-api/active_model_serializers/statuses/9c5a9a35d171350b1527db4abdab5e627760e626","head":{"label":"beauby:jsonapi-resource-links","ref":"jsonapi-resource-links","sha":"9c5a9a35d171350b1527db4abdab5e627760e626","user":{"login":"beauby","id":2215778,"avatar_url":"https://avatars.githubusercontent.com/u/2215778?v=3","gravatar_id":"","url":"https://api.github.com/users/beauby","html_url":"https://github.com/beauby","followers_url":"https://api.github.com/users/beauby/followers","following_url":"https://api.github.com/users/beauby/following{/other_user}","gists_url":"https://api.github.com/users/beauby/gists{/gist_id}","starred_url":"https://api.github.com/users/beauby/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beauby/subscriptions","organizations_url":"https://api.github.com/users/beauby/orgs","repos_url":"https://api.github.com/users/beauby/repos","events_url":"https://api.github.com/users/beauby/events{/privacy}","received_events_url":"https://api.github.com/users/beauby/received_events","type":"User","site_admin":false},"repo":{"id":30326986,"name":"active_model_serializers","full_name":"beauby/active_model_serializers","owner":{"login":"beauby","id":2215778,"avatar_url":"https://avatars.githubusercontent.com/u/2215778?v=3","gravatar_id":"","url":"https://api.github.com/users/beauby","html_url":"https://github.com/beauby","followers_url":"https://api.github.com/users/beauby/followers","following_url":"https://api.github.com/users/beauby/following{/other_user}","gists_url":"https://api.github.com/users/beauby/gists{/gist_id}","starred_url":"https://api.github.com/users/beauby/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beauby/subscriptions","organizations_url":"https://api.github.com/users/beauby/orgs","repos_url":"https://api.github.com/users/beauby/repos","events_url":"https://api.github.com/users/beauby/events{/privacy}","received_events_url":"https://api.github.com/users/beauby/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/beauby/active_model_serializers","description":"ActiveModel::Serializer implementation and Rails hooks","fork":true,"url":"https://api.github.com/repos/beauby/active_model_serializers","forks_url":"https://api.github.com/repos/beauby/active_model_serializers/forks","keys_url":"https://api.github.com/repos/beauby/active_model_serializers/keys{/key_id}","collaborators_url":"https://api.github.com/repos/beauby/active_model_serializers/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/beauby/active_model_serializers/teams","hooks_url":"https://api.github.com/repos/beauby/active_model_serializers/hooks","issue_events_url":"https://api.github.com/repos/beauby/active_model_serializers/issues/events{/number}","events_url":"https://api.github.com/repos/beauby/active_model_serializers/events","assignees_url":"https://api.github.com/repos/beauby/active_model_serializers/assignees{/user}","branches_url":"https://api.github.com/repos/beauby/active_model_serializers/branches{/branch}","tags_url":"https://api.github.com/repos/beauby/active_model_serializers/tags","blobs_url":"https://api.github.com/repos/beauby/active_model_serializers/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/beauby/active_model_serializers/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/beauby/active_model_serializers/git/refs{/sha}","trees_url":"https://api.github.com/repos/beauby/active_model_serializers/git/trees{/sha}","statuses_url":"https://api.github.com/repos/beauby/active_model_serializers/statuses/{sha}","languages_url":"https://api.github.com/repos/beauby/active_model_serializers/languages","stargazers_url":"https://api.github.com/repos/beauby/active_model_serializers/stargazers","contributors_url":"https://api.github.com/repos/beauby/active_model_serializers/contributors","subscribers_url":"https://api.github.com/repos/beauby/active_model_serializers/subscribers","subscription_url":"https://api.github.com/repos/beauby/active_model_serializers/subscription","commits_url":"https://api.github.com/repos/beauby/active_model_serializers/commits{/sha}","git_commits_url":"https://api.github.com/repos/beauby/active_model_serializers/git/commits{/sha}","comments_url":"https://api.github.com/repos/beauby/active_model_serializers/comments{/number}","issue_comment_url":"https://api.github.com/repos/beauby/active_model_serializers/issues/comments{/number}","contents_url":"https://api.github.com/repos/beauby/active_model_serializers/contents/{+path}","compare_url":"https://api.github.com/repos/beauby/active_model_serializers/compare/{base}...{head}","merges_url":"https://api.github.com/repos/beauby/active_model_serializers/merges","archive_url":"https://api.github.com/repos/beauby/active_model_serializers/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/beauby/active_model_serializers/downloads","issues_url":"https://api.github.com/repos/beauby/active_model_serializers/issues{/number}","pulls_url":"https://api.github.com/repos/beauby/active_model_serializers/pulls{/number}","milestones_url":"https://api.github.com/repos/beauby/active_model_serializers/milestones{/number}","notifications_url":"https://api.github.com/repos/beauby/active_model_serializers/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/beauby/active_model_serializers/labels{/name}","releases_url":"https://api.github.com/repos/beauby/active_model_serializers/releases{/id}","created_at":"2015-02-04T23:25:42Z","updated_at":"2015-02-04T23:25:43Z","pushed_at":"2015-10-06T23:10:50Z","git_url":"git://github.com/beauby/active_model_serializers.git","ssh_url":"git@github.com:beauby/active_model_serializers.git","clone_url":"https://github.com/beauby/active_model_serializers.git","svn_url":"https://github.com/beauby/active_model_serializers","homepage":"","size":2388,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rails-api:master","ref":"master","sha":"d02cd30fe55a3ea85e1d351b6e039620903c1871","user":{"login":"rails-api","id":2820360,"avatar_url":"https://avatars.githubusercontent.com/u/2820360?v=3","gravatar_id":"","url":"https://api.github.com/users/rails-api","html_url":"https://github.com/rails-api","followers_url":"https://api.github.com/users/rails-api/followers","following_url":"https://api.github.com/users/rails-api/following{/other_user}","gists_url":"https://api.github.com/users/rails-api/gists{/gist_id}","starred_url":"https://api.github.com/users/rails-api/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rails-api/subscriptions","organizations_url":"https://api.github.com/users/rails-api/orgs","repos_url":"https://api.github.com/users/rails-api/repos","events_url":"https://api.github.com/users/rails-api/events{/privacy}","received_events_url":"https://api.github.com/users/rails-api/received_events","type":"Organization","site_admin":false},"repo":{"id":2889230,"name":"active_model_serializers","full_name":"rails-api/active_model_serializers","owner":{"login":"rails-api","id":2820360,"avatar_url":"https://avatars.githubusercontent.com/u/2820360?v=3","gravatar_id":"","url":"https://api.github.com/users/rails-api","html_url":"https://github.com/rails-api","followers_url":"https://api.github.com/users/rails-api/followers","following_url":"https://api.github.com/users/rails-api/following{/other_user}","gists_url":"https://api.github.com/users/rails-api/gists{/gist_id}","starred_url":"https://api.github.com/users/rails-api/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rails-api/subscriptions","organizations_url":"https://api.github.com/users/rails-api/orgs","repos_url":"https://api.github.com/users/rails-api/repos","events_url":"https://api.github.com/users/rails-api/events{/privacy}","received_events_url":"https://api.github.com/users/rails-api/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rails-api/active_model_serializers","description":"ActiveModel::Serializer implementation and Rails hooks","fork":false,"url":"https://api.github.com/repos/rails-api/active_model_serializers","forks_url":"https://api.github.com/repos/rails-api/active_model_serializers/forks","keys_url":"https://api.github.com/repos/rails-api/active_model_serializers/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rails-api/active_model_serializers/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rails-api/active_model_serializers/teams","hooks_url":"https://api.github.com/repos/rails-api/active_model_serializers/hooks","issue_events_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/events{/number}","events_url":"https://api.github.com/repos/rails-api/active_model_serializers/events","assignees_url":"https://api.github.com/repos/rails-api/active_model_serializers/assignees{/user}","branches_url":"https://api.github.com/repos/rails-api/active_model_serializers/branches{/branch}","tags_url":"https://api.github.com/repos/rails-api/active_model_serializers/tags","blobs_url":"https://api.github.com/repos/rails-api/active_model_serializers/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rails-api/active_model_serializers/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rails-api/active_model_serializers/git/refs{/sha}","trees_url":"https://api.github.com/repos/rails-api/active_model_serializers/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rails-api/active_model_serializers/statuses/{sha}","languages_url":"https://api.github.com/repos/rails-api/active_model_serializers/languages","stargazers_url":"https://api.github.com/repos/rails-api/active_model_serializers/stargazers","contributors_url":"https://api.github.com/repos/rails-api/active_model_serializers/contributors","subscribers_url":"https://api.github.com/repos/rails-api/active_model_serializers/subscribers","subscription_url":"https://api.github.com/repos/rails-api/active_model_serializers/subscription","commits_url":"https://api.github.com/repos/rails-api/active_model_serializers/commits{/sha}","git_commits_url":"https://api.github.com/repos/rails-api/active_model_serializers/git/commits{/sha}","comments_url":"https://api.github.com/repos/rails-api/active_model_serializers/comments{/number}","issue_comment_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/comments{/number}","contents_url":"https://api.github.com/repos/rails-api/active_model_serializers/contents/{+path}","compare_url":"https://api.github.com/repos/rails-api/active_model_serializers/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rails-api/active_model_serializers/merges","archive_url":"https://api.github.com/repos/rails-api/active_model_serializers/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rails-api/active_model_serializers/downloads","issues_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues{/number}","pulls_url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls{/number}","milestones_url":"https://api.github.com/repos/rails-api/active_model_serializers/milestones{/number}","notifications_url":"https://api.github.com/repos/rails-api/active_model_serializers/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rails-api/active_model_serializers/labels{/name}","releases_url":"https://api.github.com/repos/rails-api/active_model_serializers/releases{/id}","created_at":"2011-12-01T06:39:26Z","updated_at":"2015-10-07T11:54:30Z","pushed_at":"2015-10-07T11:40:13Z","git_url":"git://github.com/rails-api/active_model_serializers.git","ssh_url":"git@github.com:rails-api/active_model_serializers.git","clone_url":"https://github.com/rails-api/active_model_serializers.git","svn_url":"https://github.com/rails-api/active_model_serializers","homepage":"","size":7278,"stargazers_count":3027,"watchers_count":3027,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":692,"mirror_url":null,"open_issues_count":166,"forks":692,"open_issues":166,"watchers":3027,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1246"},"html":{"href":"https://github.com/rails-api/active_model_serializers/pull/1246"},"issue":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1246"},"comments":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1246/comments"},"review_comments":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1246/comments"},"review_comment":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1246/commits"},"statuses":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/statuses/9c5a9a35d171350b1527db4abdab5e627760e626"}}}}