{"action":"created","comment":{"url":"https://api.github.com/repos/rails/rails/pulls/comments/57346954","id":57346954,"diff_hunk":"@@ -128,6 +128,13 @@ def test_no_key\n     assert !person.errors.include?(:foo)\n   end\n \n+  test \"include? does not add a key to messages hash\" do\n+    person = Person.new\n+    person.errors.include?(:foo)\n+\n+    assert_equal [], person.errors.messages.keys","path":"activemodel/test/cases/errors_test.rb","position":null,"original_position":8,"commit_id":"93548e9ef91e96f420675212c46d94c53b0158f7","original_commit_id":"e0963cc73cdb1cbb4db2e78033a7e067bd4d45d1","user":{"login":"kitop","id":143179,"avatar_url":"https://avatars.githubusercontent.com/u/143179?v=3","gravatar_id":"","url":"https://api.github.com/users/kitop","html_url":"https://github.com/kitop","followers_url":"https://api.github.com/users/kitop/followers","following_url":"https://api.github.com/users/kitop/following{/other_user}","gists_url":"https://api.github.com/users/kitop/gists{/gist_id}","starred_url":"https://api.github.com/users/kitop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kitop/subscriptions","organizations_url":"https://api.github.com/users/kitop/orgs","repos_url":"https://api.github.com/users/kitop/repos","events_url":"https://api.github.com/users/kitop/events{/privacy}","received_events_url":"https://api.github.com/users/kitop/received_events","type":"User","site_admin":false},"body":"Done. Let me know if that looks OK now.","created_at":"2016-03-24T16:42:08Z","updated_at":"2016-03-24T16:42:08Z","html_url":"https://github.com/rails/rails/pull/24299#discussion_r57346954","pull_request_url":"https://api.github.com/repos/rails/rails/pulls/24299","_links":{"self":{"href":"https://api.github.com/repos/rails/rails/pulls/comments/57346954"},"html":{"href":"https://github.com/rails/rails/pull/24299#discussion_r57346954"},"pull_request":{"href":"https://api.github.com/repos/rails/rails/pulls/24299"}}},"pull_request":{"url":"https://api.github.com/repos/rails/rails/pulls/24299","id":64042840,"html_url":"https://github.com/rails/rails/pull/24299","diff_url":"https://github.com/rails/rails/pull/24299.diff","patch_url":"https://github.com/rails/rails/pull/24299.patch","issue_url":"https://api.github.com/repos/rails/rails/issues/24299","number":24299,"state":"open","locked":false,"title":"Do not create a hash key when calling ActiveModel::Errors#include?","user":{"login":"kitop","id":143179,"avatar_url":"https://avatars.githubusercontent.com/u/143179?v=3","gravatar_id":"","url":"https://api.github.com/users/kitop","html_url":"https://github.com/kitop","followers_url":"https://api.github.com/users/kitop/followers","following_url":"https://api.github.com/users/kitop/following{/other_user}","gists_url":"https://api.github.com/users/kitop/gists{/gist_id}","starred_url":"https://api.github.com/users/kitop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kitop/subscriptions","organizations_url":"https://api.github.com/users/kitop/orgs","repos_url":"https://api.github.com/users/kitop/repos","events_url":"https://api.github.com/users/kitop/events{/privacy}","received_events_url":"https://api.github.com/users/kitop/received_events","type":"User","site_admin":false},"body":"### Summary\r\n\r\nFrom: https://github.com/rails/rails/issues/24279\r\n\r\nWhen doing `record.errors.include? :foo`, it adds a new key to the\r\n@messages hash that defaults to an empty array.\r\n\r\nThis happens because of a combination of these 2 commits:\r\nhttps://github.com/rails/rails/commit/b97035df64f5b2f912425c4a7fcb6e6bb3ddab8d\r\n(Added in Rails 4.1)\r\nand\r\nhttps://github.com/rails/rails/commit/6ec8ba16d85d5feaccb993c9756c1edcbbf0ba13#diff-fdcf8b65b5fb954372c6fe1ddf284c78R76\r\n(Rails 5.0)\r\n\r\nBy adding the default proc that returns an array for non-existing keys,\r\nruby adds that key to the hash.\r\n\r\nThis commit changes `#include?` to check with `has_key?` and then check if that value is\r\n`present?`.","created_at":"2016-03-24T14:38:42Z","updated_at":"2016-03-24T16:42:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a8d96187ad58ad8d2c2a2b7f91a4c2cfe612573d","assignee":{"login":"pixeltrix","id":6321,"avatar_url":"https://avatars.githubusercontent.com/u/6321?v=3","gravatar_id":"","url":"https://api.github.com/users/pixeltrix","html_url":"https://github.com/pixeltrix","followers_url":"https://api.github.com/users/pixeltrix/followers","following_url":"https://api.github.com/users/pixeltrix/following{/other_user}","gists_url":"https://api.github.com/users/pixeltrix/gists{/gist_id}","starred_url":"https://api.github.com/users/pixeltrix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pixeltrix/subscriptions","organizations_url":"https://api.github.com/users/pixeltrix/orgs","repos_url":"https://api.github.com/users/pixeltrix/repos","events_url":"https://api.github.com/users/pixeltrix/events{/privacy}","received_events_url":"https://api.github.com/users/pixeltrix/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/rails/rails/milestones/47","html_url":"https://github.com/rails/rails/milestones/5.0.0","labels_url":"https://api.github.com/repos/rails/rails/milestones/47/labels","id":1467326,"number":47,"title":"5.0.0","description":"","creator":{"login":"rafaelfranca","id":47848,"avatar_url":"https://avatars.githubusercontent.com/u/47848?v=3","gravatar_id":"","url":"https://api.github.com/users/rafaelfranca","html_url":"https://github.com/rafaelfranca","followers_url":"https://api.github.com/users/rafaelfranca/followers","following_url":"https://api.github.com/users/rafaelfranca/following{/other_user}","gists_url":"https://api.github.com/users/rafaelfranca/gists{/gist_id}","starred_url":"https://api.github.com/users/rafaelfranca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rafaelfranca/subscriptions","organizations_url":"https://api.github.com/users/rafaelfranca/orgs","repos_url":"https://api.github.com/users/rafaelfranca/repos","events_url":"https://api.github.com/users/rafaelfranca/events{/privacy}","received_events_url":"https://api.github.com/users/rafaelfranca/received_events","type":"User","site_admin":false},"open_issues":14,"closed_issues":410,"state":"open","created_at":"2015-12-18T21:17:59Z","updated_at":"2016-03-24T14:40:57Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/rails/rails/pulls/24299/commits","review_comments_url":"https://api.github.com/repos/rails/rails/pulls/24299/comments","review_comment_url":"https://api.github.com/repos/rails/rails/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rails/rails/issues/24299/comments","statuses_url":"https://api.github.com/repos/rails/rails/statuses/93548e9ef91e96f420675212c46d94c53b0158f7","head":{"label":"kitop:activemodel-errors-include-fix","ref":"activemodel-errors-include-fix","sha":"93548e9ef91e96f420675212c46d94c53b0158f7","user":{"login":"kitop","id":143179,"avatar_url":"https://avatars.githubusercontent.com/u/143179?v=3","gravatar_id":"","url":"https://api.github.com/users/kitop","html_url":"https://github.com/kitop","followers_url":"https://api.github.com/users/kitop/followers","following_url":"https://api.github.com/users/kitop/following{/other_user}","gists_url":"https://api.github.com/users/kitop/gists{/gist_id}","starred_url":"https://api.github.com/users/kitop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kitop/subscriptions","organizations_url":"https://api.github.com/users/kitop/orgs","repos_url":"https://api.github.com/users/kitop/repos","events_url":"https://api.github.com/users/kitop/events{/privacy}","received_events_url":"https://api.github.com/users/kitop/received_events","type":"User","site_admin":false},"repo":{"id":54645574,"name":"rails","full_name":"kitop/rails","owner":{"login":"kitop","id":143179,"avatar_url":"https://avatars.githubusercontent.com/u/143179?v=3","gravatar_id":"","url":"https://api.github.com/users/kitop","html_url":"https://github.com/kitop","followers_url":"https://api.github.com/users/kitop/followers","following_url":"https://api.github.com/users/kitop/following{/other_user}","gists_url":"https://api.github.com/users/kitop/gists{/gist_id}","starred_url":"https://api.github.com/users/kitop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kitop/subscriptions","organizations_url":"https://api.github.com/users/kitop/orgs","repos_url":"https://api.github.com/users/kitop/repos","events_url":"https://api.github.com/users/kitop/events{/privacy}","received_events_url":"https://api.github.com/users/kitop/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kitop/rails","description":"Ruby on Rails","fork":true,"url":"https://api.github.com/repos/kitop/rails","forks_url":"https://api.github.com/repos/kitop/rails/forks","keys_url":"https://api.github.com/repos/kitop/rails/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kitop/rails/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kitop/rails/teams","hooks_url":"https://api.github.com/repos/kitop/rails/hooks","issue_events_url":"https://api.github.com/repos/kitop/rails/issues/events{/number}","events_url":"https://api.github.com/repos/kitop/rails/events","assignees_url":"https://api.github.com/repos/kitop/rails/assignees{/user}","branches_url":"https://api.github.com/repos/kitop/rails/branches{/branch}","tags_url":"https://api.github.com/repos/kitop/rails/tags","blobs_url":"https://api.github.com/repos/kitop/rails/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kitop/rails/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kitop/rails/git/refs{/sha}","trees_url":"https://api.github.com/repos/kitop/rails/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kitop/rails/statuses/{sha}","languages_url":"https://api.github.com/repos/kitop/rails/languages","stargazers_url":"https://api.github.com/repos/kitop/rails/stargazers","contributors_url":"https://api.github.com/repos/kitop/rails/contributors","subscribers_url":"https://api.github.com/repos/kitop/rails/subscribers","subscription_url":"https://api.github.com/repos/kitop/rails/subscription","commits_url":"https://api.github.com/repos/kitop/rails/commits{/sha}","git_commits_url":"https://api.github.com/repos/kitop/rails/git/commits{/sha}","comments_url":"https://api.github.com/repos/kitop/rails/comments{/number}","issue_comment_url":"https://api.github.com/repos/kitop/rails/issues/comments{/number}","contents_url":"https://api.github.com/repos/kitop/rails/contents/{+path}","compare_url":"https://api.github.com/repos/kitop/rails/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kitop/rails/merges","archive_url":"https://api.github.com/repos/kitop/rails/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kitop/rails/downloads","issues_url":"https://api.github.com/repos/kitop/rails/issues{/number}","pulls_url":"https://api.github.com/repos/kitop/rails/pulls{/number}","milestones_url":"https://api.github.com/repos/kitop/rails/milestones{/number}","notifications_url":"https://api.github.com/repos/kitop/rails/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kitop/rails/labels{/name}","releases_url":"https://api.github.com/repos/kitop/rails/releases{/id}","deployments_url":"https://api.github.com/repos/kitop/rails/deployments","created_at":"2016-03-24T13:53:30Z","updated_at":"2016-03-24T13:54:25Z","pushed_at":"2016-03-24T16:41:40Z","git_url":"git://github.com/kitop/rails.git","ssh_url":"git@github.com:kitop/rails.git","clone_url":"https://github.com/kitop/rails.git","svn_url":"https://github.com/kitop/rails","homepage":"http://rubyonrails.org","size":128941,"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:master","ref":"master","sha":"2e8a350c38715787ab79603bf1e4b6296e23d80b","user":{"login":"rails","id":4223,"avatar_url":"https://avatars.githubusercontent.com/u/4223?v=3","gravatar_id":"","url":"https://api.github.com/users/rails","html_url":"https://github.com/rails","followers_url":"https://api.github.com/users/rails/followers","following_url":"https://api.github.com/users/rails/following{/other_user}","gists_url":"https://api.github.com/users/rails/gists{/gist_id}","starred_url":"https://api.github.com/users/rails/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rails/subscriptions","organizations_url":"https://api.github.com/users/rails/orgs","repos_url":"https://api.github.com/users/rails/repos","events_url":"https://api.github.com/users/rails/events{/privacy}","received_events_url":"https://api.github.com/users/rails/received_events","type":"Organization","site_admin":false},"repo":{"id":8514,"name":"rails","full_name":"rails/rails","owner":{"login":"rails","id":4223,"avatar_url":"https://avatars.githubusercontent.com/u/4223?v=3","gravatar_id":"","url":"https://api.github.com/users/rails","html_url":"https://github.com/rails","followers_url":"https://api.github.com/users/rails/followers","following_url":"https://api.github.com/users/rails/following{/other_user}","gists_url":"https://api.github.com/users/rails/gists{/gist_id}","starred_url":"https://api.github.com/users/rails/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rails/subscriptions","organizations_url":"https://api.github.com/users/rails/orgs","repos_url":"https://api.github.com/users/rails/repos","events_url":"https://api.github.com/users/rails/events{/privacy}","received_events_url":"https://api.github.com/users/rails/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rails/rails","description":"Ruby on Rails","fork":false,"url":"https://api.github.com/repos/rails/rails","forks_url":"https://api.github.com/repos/rails/rails/forks","keys_url":"https://api.github.com/repos/rails/rails/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rails/rails/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rails/rails/teams","hooks_url":"https://api.github.com/repos/rails/rails/hooks","issue_events_url":"https://api.github.com/repos/rails/rails/issues/events{/number}","events_url":"https://api.github.com/repos/rails/rails/events","assignees_url":"https://api.github.com/repos/rails/rails/assignees{/user}","branches_url":"https://api.github.com/repos/rails/rails/branches{/branch}","tags_url":"https://api.github.com/repos/rails/rails/tags","blobs_url":"https://api.github.com/repos/rails/rails/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rails/rails/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rails/rails/git/refs{/sha}","trees_url":"https://api.github.com/repos/rails/rails/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rails/rails/statuses/{sha}","languages_url":"https://api.github.com/repos/rails/rails/languages","stargazers_url":"https://api.github.com/repos/rails/rails/stargazers","contributors_url":"https://api.github.com/repos/rails/rails/contributors","subscribers_url":"https://api.github.com/repos/rails/rails/subscribers","subscription_url":"https://api.github.com/repos/rails/rails/subscription","commits_url":"https://api.github.com/repos/rails/rails/commits{/sha}","git_commits_url":"https://api.github.com/repos/rails/rails/git/commits{/sha}","comments_url":"https://api.github.com/repos/rails/rails/comments{/number}","issue_comment_url":"https://api.github.com/repos/rails/rails/issues/comments{/number}","contents_url":"https://api.github.com/repos/rails/rails/contents/{+path}","compare_url":"https://api.github.com/repos/rails/rails/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rails/rails/merges","archive_url":"https://api.github.com/repos/rails/rails/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rails/rails/downloads","issues_url":"https://api.github.com/repos/rails/rails/issues{/number}","pulls_url":"https://api.github.com/repos/rails/rails/pulls{/number}","milestones_url":"https://api.github.com/repos/rails/rails/milestones{/number}","notifications_url":"https://api.github.com/repos/rails/rails/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rails/rails/labels{/name}","releases_url":"https://api.github.com/repos/rails/rails/releases{/id}","deployments_url":"https://api.github.com/repos/rails/rails/deployments","created_at":"2008-04-11T02:19:47Z","updated_at":"2016-03-24T16:22:54Z","pushed_at":"2016-03-24T16:41:48Z","git_url":"git://github.com/rails/rails.git","ssh_url":"git@github.com:rails/rails.git","clone_url":"https://github.com/rails/rails.git","svn_url":"https://github.com/rails/rails","homepage":"http://rubyonrails.org","size":331392,"stargazers_count":30323,"watchers_count":30323,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":12302,"mirror_url":null,"open_issues_count":910,"forks":12302,"open_issues":910,"watchers":30323,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rails/rails/pulls/24299"},"html":{"href":"https://github.com/rails/rails/pull/24299"},"issue":{"href":"https://api.github.com/repos/rails/rails/issues/24299"},"comments":{"href":"https://api.github.com/repos/rails/rails/issues/24299/comments"},"review_comments":{"href":"https://api.github.com/repos/rails/rails/pulls/24299/comments"},"review_comment":{"href":"https://api.github.com/repos/rails/rails/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rails/rails/pulls/24299/commits"},"statuses":{"href":"https://api.github.com/repos/rails/rails/statuses/93548e9ef91e96f420675212c46d94c53b0158f7"}}}}