{"action":"created","comment":{"url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/comments/84306867","pull_request_review_id":5091825,"id":84306867,"diff_hunk":"@@ -26,6 +26,31 @@ def test_overwritten_serializer_for_array\n         end\n       end\n \n+      class SerializerNotFoundTest < ActiveSupport::TestCase\n+        class Post < ActiveRecord::Base; end\n+        class PostSerializer < ActiveModel::Serializer; end\n+        class Comment < ActiveRecord::Base; end\n+\n+        def setup\n+          @previous_serializer_not_found_policy = ActiveModelSerializers.config.on_serializer_not_found\n+          ActiveModelSerializers.config.on_serializer_not_found = -> (klass) { fail NameError, \"Serializer for [#{klass}] not found\" }\n+        end\n+\n+        def teardown\n+          ActiveModelSerializers.config.on_serializer_not_found = @previous_serializer_not_found_policy\n+        end\n+\n+        def test_serializer_not_found_triggers_configured_policy","path":"test/serializers/serializer_for_test.rb","position":18,"original_position":18,"commit_id":"ab949e0ebfab8ecae60e8d83a0583b9107839e70","original_commit_id":"ab949e0ebfab8ecae60e8d83a0583b9107839e70","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},"body":"can you change these to the `test 'serializer not found triggers configured policy'` test format.\r\n\r\nThanks!","created_at":"2016-10-20T15:19:06Z","updated_at":"2016-10-20T15:19:45Z","html_url":"https://github.com/rails-api/active_model_serializers/pull/1949#discussion_r84306867","pull_request_url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1949","_links":{"self":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/comments/84306867"},"html":{"href":"https://github.com/rails-api/active_model_serializers/pull/1949#discussion_r84306867"},"pull_request":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1949"}}},"pull_request":{"url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1949","id":90213301,"html_url":"https://github.com/rails-api/active_model_serializers/pull/1949","diff_url":"https://github.com/rails-api/active_model_serializers/pull/1949.diff","patch_url":"https://github.com/rails-api/active_model_serializers/pull/1949.patch","issue_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1949","number":1949,"state":"open","locked":false,"title":"Add explicit serializer not found policy","user":{"login":"GregPK","id":687754,"avatar_url":"https://avatars.githubusercontent.com/u/687754?v=3","gravatar_id":"","url":"https://api.github.com/users/GregPK","html_url":"https://github.com/GregPK","followers_url":"https://api.github.com/users/GregPK/followers","following_url":"https://api.github.com/users/GregPK/following{/other_user}","gists_url":"https://api.github.com/users/GregPK/gists{/gist_id}","starred_url":"https://api.github.com/users/GregPK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GregPK/subscriptions","organizations_url":"https://api.github.com/users/GregPK/orgs","repos_url":"https://api.github.com/users/GregPK/repos","events_url":"https://api.github.com/users/GregPK/events{/privacy}","received_events_url":"https://api.github.com/users/GregPK/received_events","type":"User","site_admin":false},"body":"#### Purpose\r\nAllow users to setup a policy to fail explicity when an `ActiveRecord::Base` inherited model is being used without an explicit `Serializer` defined.\r\n\r\nCurrently, when rendering a `ActiveRecord::Base` model it falls back on the default JSON serializer, exposing all attributes.\r\n\r\n#### Changes\r\n* `ActiveModel::Serializer#get_serializer_for`\r\n\r\n#### Caveats\r\n* `![BasicObject, Object].include?(klass.superclass)` code is ugly, but makes sure that a meaningful class can be passed to the policy (see spec message example)\r\n\r\n#### Related GitHub issues\r\n* https://github.com/rails-api/active_model_serializers/issues/1853\r\n\r\n\r\n\r\n\r\n","created_at":"2016-10-20T14:35:53Z","updated_at":"2016-10-20T15:19:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b1d6d5ab2f223d6975c2d35a69d1390da27dc32a","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1949/commits","review_comments_url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1949/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/1949/comments","statuses_url":"https://api.github.com/repos/rails-api/active_model_serializers/statuses/ab949e0ebfab8ecae60e8d83a0583b9107839e70","head":{"label":"GregPK:issue_1853_serializer_not_found_policy","ref":"issue_1853_serializer_not_found_policy","sha":"ab949e0ebfab8ecae60e8d83a0583b9107839e70","user":{"login":"GregPK","id":687754,"avatar_url":"https://avatars.githubusercontent.com/u/687754?v=3","gravatar_id":"","url":"https://api.github.com/users/GregPK","html_url":"https://github.com/GregPK","followers_url":"https://api.github.com/users/GregPK/followers","following_url":"https://api.github.com/users/GregPK/following{/other_user}","gists_url":"https://api.github.com/users/GregPK/gists{/gist_id}","starred_url":"https://api.github.com/users/GregPK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GregPK/subscriptions","organizations_url":"https://api.github.com/users/GregPK/orgs","repos_url":"https://api.github.com/users/GregPK/repos","events_url":"https://api.github.com/users/GregPK/events{/privacy}","received_events_url":"https://api.github.com/users/GregPK/received_events","type":"User","site_admin":false},"repo":{"id":71459200,"name":"active_model_serializers","full_name":"GregPK/active_model_serializers","owner":{"login":"GregPK","id":687754,"avatar_url":"https://avatars.githubusercontent.com/u/687754?v=3","gravatar_id":"","url":"https://api.github.com/users/GregPK","html_url":"https://github.com/GregPK","followers_url":"https://api.github.com/users/GregPK/followers","following_url":"https://api.github.com/users/GregPK/following{/other_user}","gists_url":"https://api.github.com/users/GregPK/gists{/gist_id}","starred_url":"https://api.github.com/users/GregPK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GregPK/subscriptions","organizations_url":"https://api.github.com/users/GregPK/orgs","repos_url":"https://api.github.com/users/GregPK/repos","events_url":"https://api.github.com/users/GregPK/events{/privacy}","received_events_url":"https://api.github.com/users/GregPK/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/GregPK/active_model_serializers","description":"ActiveModel::Serializer implementation and Rails hooks","fork":true,"url":"https://api.github.com/repos/GregPK/active_model_serializers","forks_url":"https://api.github.com/repos/GregPK/active_model_serializers/forks","keys_url":"https://api.github.com/repos/GregPK/active_model_serializers/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GregPK/active_model_serializers/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GregPK/active_model_serializers/teams","hooks_url":"https://api.github.com/repos/GregPK/active_model_serializers/hooks","issue_events_url":"https://api.github.com/repos/GregPK/active_model_serializers/issues/events{/number}","events_url":"https://api.github.com/repos/GregPK/active_model_serializers/events","assignees_url":"https://api.github.com/repos/GregPK/active_model_serializers/assignees{/user}","branches_url":"https://api.github.com/repos/GregPK/active_model_serializers/branches{/branch}","tags_url":"https://api.github.com/repos/GregPK/active_model_serializers/tags","blobs_url":"https://api.github.com/repos/GregPK/active_model_serializers/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GregPK/active_model_serializers/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GregPK/active_model_serializers/git/refs{/sha}","trees_url":"https://api.github.com/repos/GregPK/active_model_serializers/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GregPK/active_model_serializers/statuses/{sha}","languages_url":"https://api.github.com/repos/GregPK/active_model_serializers/languages","stargazers_url":"https://api.github.com/repos/GregPK/active_model_serializers/stargazers","contributors_url":"https://api.github.com/repos/GregPK/active_model_serializers/contributors","subscribers_url":"https://api.github.com/repos/GregPK/active_model_serializers/subscribers","subscription_url":"https://api.github.com/repos/GregPK/active_model_serializers/subscription","commits_url":"https://api.github.com/repos/GregPK/active_model_serializers/commits{/sha}","git_commits_url":"https://api.github.com/repos/GregPK/active_model_serializers/git/commits{/sha}","comments_url":"https://api.github.com/repos/GregPK/active_model_serializers/comments{/number}","issue_comment_url":"https://api.github.com/repos/GregPK/active_model_serializers/issues/comments{/number}","contents_url":"https://api.github.com/repos/GregPK/active_model_serializers/contents/{+path}","compare_url":"https://api.github.com/repos/GregPK/active_model_serializers/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GregPK/active_model_serializers/merges","archive_url":"https://api.github.com/repos/GregPK/active_model_serializers/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GregPK/active_model_serializers/downloads","issues_url":"https://api.github.com/repos/GregPK/active_model_serializers/issues{/number}","pulls_url":"https://api.github.com/repos/GregPK/active_model_serializers/pulls{/number}","milestones_url":"https://api.github.com/repos/GregPK/active_model_serializers/milestones{/number}","notifications_url":"https://api.github.com/repos/GregPK/active_model_serializers/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GregPK/active_model_serializers/labels{/name}","releases_url":"https://api.github.com/repos/GregPK/active_model_serializers/releases{/id}","deployments_url":"https://api.github.com/repos/GregPK/active_model_serializers/deployments","created_at":"2016-10-20T12:08:05Z","updated_at":"2016-10-20T12:08:06Z","pushed_at":"2016-10-20T14:32:57Z","git_url":"git://github.com/GregPK/active_model_serializers.git","ssh_url":"git@github.com:GregPK/active_model_serializers.git","clone_url":"https://github.com/GregPK/active_model_serializers.git","svn_url":"https://github.com/GregPK/active_model_serializers","homepage":"","size":5403,"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":"6c6e45b23f464bd0bb92ae05a4284b72b017be21","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}","deployments_url":"https://api.github.com/repos/rails-api/active_model_serializers/deployments","created_at":"2011-12-01T06:39:26Z","updated_at":"2016-10-20T13:39:56Z","pushed_at":"2016-10-20T14:35:54Z","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":5403,"stargazers_count":3808,"watchers_count":3808,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1015,"mirror_url":null,"open_issues_count":122,"forks":1015,"open_issues":122,"watchers":3808,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1949"},"html":{"href":"https://github.com/rails-api/active_model_serializers/pull/1949"},"issue":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1949"},"comments":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1949/comments"},"review_comments":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1949/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/1949/commits"},"statuses":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/statuses/ab949e0ebfab8ecae60e8d83a0583b9107839e70"}}}}
{"actor":{"display_login":"NullVoxPopuli"}}