{"action":"created","comment":{"url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/comments/40844335","id":40844335,"diff_hunk":"@@ -46,6 +47,10 @@ def self.inherited(base)\n       super\n     end\n \n+    def self.type(type)\n+      self._type = type\n+    end","path":"lib/active_model/serializer.rb","position":14,"original_position":14,"commit_id":"1f56497e4f1c6961c5b970fc09fec765451b34b8","original_commit_id":"1f56497e4f1c6961c5b970fc09fec765451b34b8","user":{"login":"youroff","id":1385801,"avatar_url":"https://avatars.githubusercontent.com/u/1385801?v=3","gravatar_id":"","url":"https://api.github.com/users/youroff","html_url":"https://github.com/youroff","followers_url":"https://api.github.com/users/youroff/followers","following_url":"https://api.github.com/users/youroff/following{/other_user}","gists_url":"https://api.github.com/users/youroff/gists{/gist_id}","starred_url":"https://api.github.com/users/youroff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/youroff/subscriptions","organizations_url":"https://api.github.com/users/youroff/orgs","repos_url":"https://api.github.com/users/youroff/repos","events_url":"https://api.github.com/users/youroff/events{/privacy}","received_events_url":"https://api.github.com/users/youroff/received_events","type":"User","site_admin":false},"body":"I'm not sure it's narrow. Underscored class-level accessor will be accessible anyways.","created_at":"2015-09-30T20:07:36Z","updated_at":"2015-09-30T20:07:36Z","html_url":"https://github.com/rails-api/active_model_serializers/pull/1213#discussion_r40844335","pull_request_url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1213","_links":{"self":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/comments/40844335"},"html":{"href":"https://github.com/rails-api/active_model_serializers/pull/1213#discussion_r40844335"},"pull_request":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1213"}}},"pull_request":{"url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1213","id":46307989,"html_url":"https://github.com/rails-api/active_model_serializers/pull/1213","diff_url":"https://github.com/rails-api/active_model_serializers/pull/1213.diff","patch_url":"https://github.com/rails-api/active_model_serializers/pull/1213.patch","issue_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1213","number":1213,"state":"open","locked":false,"title":"`type` directive for serializer to control type field with json-api adapter","user":{"login":"youroff","id":1385801,"avatar_url":"https://avatars.githubusercontent.com/u/1385801?v=3","gravatar_id":"","url":"https://api.github.com/users/youroff","html_url":"https://github.com/youroff","followers_url":"https://api.github.com/users/youroff/followers","following_url":"https://api.github.com/users/youroff/following{/other_user}","gists_url":"https://api.github.com/users/youroff/gists{/gist_id}","starred_url":"https://api.github.com/users/youroff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/youroff/subscriptions","organizations_url":"https://api.github.com/users/youroff/orgs","repos_url":"https://api.github.com/users/youroff/repos","events_url":"https://api.github.com/users/youroff/events{/privacy}","received_events_url":"https://api.github.com/users/youroff/received_events","type":"User","site_admin":false},"body":"This pull-requests implements `type` directive for serializer declaration. Which sets type attribute while using json-api adapter. So it's possible to use ProfileSerializer with User model and set type field to 'profile', like this:\r\n```\r\nclass ProfileSerializer < ActiveModel::Serializer\r\n  attributes :name\r\n  type 'profile'\r\nend\r\n```","created_at":"2015-09-29T17:37:50Z","updated_at":"2015-09-30T20:07:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b3a2d7ff75c237c3764da5629cced3e53a4fab72","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1213/commits","review_comments_url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1213/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/1213/comments","statuses_url":"https://api.github.com/repos/rails-api/active_model_serializers/statuses/1f56497e4f1c6961c5b970fc09fec765451b34b8","head":{"label":"AutoCloud:type_setting","ref":"type_setting","sha":"1f56497e4f1c6961c5b970fc09fec765451b34b8","user":{"login":"AutoCloud","id":5479526,"avatar_url":"https://avatars.githubusercontent.com/u/5479526?v=3","gravatar_id":"","url":"https://api.github.com/users/AutoCloud","html_url":"https://github.com/AutoCloud","followers_url":"https://api.github.com/users/AutoCloud/followers","following_url":"https://api.github.com/users/AutoCloud/following{/other_user}","gists_url":"https://api.github.com/users/AutoCloud/gists{/gist_id}","starred_url":"https://api.github.com/users/AutoCloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AutoCloud/subscriptions","organizations_url":"https://api.github.com/users/AutoCloud/orgs","repos_url":"https://api.github.com/users/AutoCloud/repos","events_url":"https://api.github.com/users/AutoCloud/events{/privacy}","received_events_url":"https://api.github.com/users/AutoCloud/received_events","type":"Organization","site_admin":false},"repo":{"id":43329197,"name":"active_model_serializers","full_name":"AutoCloud/active_model_serializers","owner":{"login":"AutoCloud","id":5479526,"avatar_url":"https://avatars.githubusercontent.com/u/5479526?v=3","gravatar_id":"","url":"https://api.github.com/users/AutoCloud","html_url":"https://github.com/AutoCloud","followers_url":"https://api.github.com/users/AutoCloud/followers","following_url":"https://api.github.com/users/AutoCloud/following{/other_user}","gists_url":"https://api.github.com/users/AutoCloud/gists{/gist_id}","starred_url":"https://api.github.com/users/AutoCloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AutoCloud/subscriptions","organizations_url":"https://api.github.com/users/AutoCloud/orgs","repos_url":"https://api.github.com/users/AutoCloud/repos","events_url":"https://api.github.com/users/AutoCloud/events{/privacy}","received_events_url":"https://api.github.com/users/AutoCloud/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/AutoCloud/active_model_serializers","description":"ActiveModel::Serializer implementation and Rails hooks","fork":true,"url":"https://api.github.com/repos/AutoCloud/active_model_serializers","forks_url":"https://api.github.com/repos/AutoCloud/active_model_serializers/forks","keys_url":"https://api.github.com/repos/AutoCloud/active_model_serializers/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AutoCloud/active_model_serializers/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AutoCloud/active_model_serializers/teams","hooks_url":"https://api.github.com/repos/AutoCloud/active_model_serializers/hooks","issue_events_url":"https://api.github.com/repos/AutoCloud/active_model_serializers/issues/events{/number}","events_url":"https://api.github.com/repos/AutoCloud/active_model_serializers/events","assignees_url":"https://api.github.com/repos/AutoCloud/active_model_serializers/assignees{/user}","branches_url":"https://api.github.com/repos/AutoCloud/active_model_serializers/branches{/branch}","tags_url":"https://api.github.com/repos/AutoCloud/active_model_serializers/tags","blobs_url":"https://api.github.com/repos/AutoCloud/active_model_serializers/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AutoCloud/active_model_serializers/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AutoCloud/active_model_serializers/git/refs{/sha}","trees_url":"https://api.github.com/repos/AutoCloud/active_model_serializers/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AutoCloud/active_model_serializers/statuses/{sha}","languages_url":"https://api.github.com/repos/AutoCloud/active_model_serializers/languages","stargazers_url":"https://api.github.com/repos/AutoCloud/active_model_serializers/stargazers","contributors_url":"https://api.github.com/repos/AutoCloud/active_model_serializers/contributors","subscribers_url":"https://api.github.com/repos/AutoCloud/active_model_serializers/subscribers","subscription_url":"https://api.github.com/repos/AutoCloud/active_model_serializers/subscription","commits_url":"https://api.github.com/repos/AutoCloud/active_model_serializers/commits{/sha}","git_commits_url":"https://api.github.com/repos/AutoCloud/active_model_serializers/git/commits{/sha}","comments_url":"https://api.github.com/repos/AutoCloud/active_model_serializers/comments{/number}","issue_comment_url":"https://api.github.com/repos/AutoCloud/active_model_serializers/issues/comments{/number}","contents_url":"https://api.github.com/repos/AutoCloud/active_model_serializers/contents/{+path}","compare_url":"https://api.github.com/repos/AutoCloud/active_model_serializers/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AutoCloud/active_model_serializers/merges","archive_url":"https://api.github.com/repos/AutoCloud/active_model_serializers/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AutoCloud/active_model_serializers/downloads","issues_url":"https://api.github.com/repos/AutoCloud/active_model_serializers/issues{/number}","pulls_url":"https://api.github.com/repos/AutoCloud/active_model_serializers/pulls{/number}","milestones_url":"https://api.github.com/repos/AutoCloud/active_model_serializers/milestones{/number}","notifications_url":"https://api.github.com/repos/AutoCloud/active_model_serializers/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AutoCloud/active_model_serializers/labels{/name}","releases_url":"https://api.github.com/repos/AutoCloud/active_model_serializers/releases{/id}","created_at":"2015-09-28T21:56:40Z","updated_at":"2015-09-28T21:56:42Z","pushed_at":"2015-09-30T19:10:14Z","git_url":"git://github.com/AutoCloud/active_model_serializers.git","ssh_url":"git@github.com:AutoCloud/active_model_serializers.git","clone_url":"https://github.com/AutoCloud/active_model_serializers.git","svn_url":"https://github.com/AutoCloud/active_model_serializers","homepage":"","size":7002,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"1f08865a10bb06648efc170768c8c9937d441f45","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-09-30T12:05:23Z","pushed_at":"2015-09-30T19:13:32Z","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":7002,"stargazers_count":3008,"watchers_count":3008,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":690,"mirror_url":null,"open_issues_count":154,"forks":690,"open_issues":154,"watchers":3008,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1213"},"html":{"href":"https://github.com/rails-api/active_model_serializers/pull/1213"},"issue":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1213"},"comments":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1213/comments"},"review_comments":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1213/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/1213/commits"},"statuses":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/statuses/1f56497e4f1c6961c5b970fc09fec765451b34b8"}}}}