{"action":"opened","number":31964,"pull_request":{"url":"https://api.github.com/repos/rails/rails/pulls/31964","id":168559736,"html_url":"https://github.com/rails/rails/pull/31964","diff_url":"https://github.com/rails/rails/pull/31964.diff","patch_url":"https://github.com/rails/rails/pull/31964.patch","issue_url":"https://api.github.com/repos/rails/rails/issues/31964","number":31964,"state":"open","locked":false,"title":"Allow some purge in many.rb","user":{"login":"nicholasshirley","id":1556844,"avatar_url":"https://avatars2.githubusercontent.com/u/1556844?v=4","gravatar_id":"","url":"https://api.github.com/users/nicholasshirley","html_url":"https://github.com/nicholasshirley","followers_url":"https://api.github.com/users/nicholasshirley/followers","following_url":"https://api.github.com/users/nicholasshirley/following{/other_user}","gists_url":"https://api.github.com/users/nicholasshirley/gists{/gist_id}","starred_url":"https://api.github.com/users/nicholasshirley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicholasshirley/subscriptions","organizations_url":"https://api.github.com/users/nicholasshirley/orgs","repos_url":"https://api.github.com/users/nicholasshirley/repos","events_url":"https://api.github.com/users/nicholasshirley/events{/privacy}","received_events_url":"https://api.github.com/users/nicholasshirley/received_events","type":"User","site_admin":false},"body":"This changes the purge method in `attachment/many.rb` to\r\nallow it to take an array of IDs so that records can be selectively\r\ndeleted.\r\n\r\n### Summary\r\n\r\nFor the has_many relationship of attachments, I expected there to be a way to delete both the attachment and blob for a single record, even if there were multiple attachments. In the source, I see that `purge` and `purge_later` in both `one.rb` and `many.rb` remove all records. I changed the method to perform an additional check if the user passes an array of IDs to then selectively delete only these. If no arguments are passed, purge still works as before.\r\n\r\n### Other Information\r\n\r\nI made a small test where you can see the changes in action here: https://github.com/nicholasshirley/some-purge-test","created_at":"2018-02-12T11:54:25Z","updated_at":"2018-02-12T11:54:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/rails/rails/pulls/31964/commits","review_comments_url":"https://api.github.com/repos/rails/rails/pulls/31964/comments","review_comment_url":"https://api.github.com/repos/rails/rails/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rails/rails/issues/31964/comments","statuses_url":"https://api.github.com/repos/rails/rails/statuses/1ab56e88ce1687772deb11a1e6e5f256b21a7e4a","head":{"label":"nicholasshirley:allow-some-purge","ref":"allow-some-purge","sha":"1ab56e88ce1687772deb11a1e6e5f256b21a7e4a","user":{"login":"nicholasshirley","id":1556844,"avatar_url":"https://avatars2.githubusercontent.com/u/1556844?v=4","gravatar_id":"","url":"https://api.github.com/users/nicholasshirley","html_url":"https://github.com/nicholasshirley","followers_url":"https://api.github.com/users/nicholasshirley/followers","following_url":"https://api.github.com/users/nicholasshirley/following{/other_user}","gists_url":"https://api.github.com/users/nicholasshirley/gists{/gist_id}","starred_url":"https://api.github.com/users/nicholasshirley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicholasshirley/subscriptions","organizations_url":"https://api.github.com/users/nicholasshirley/orgs","repos_url":"https://api.github.com/users/nicholasshirley/repos","events_url":"https://api.github.com/users/nicholasshirley/events{/privacy}","received_events_url":"https://api.github.com/users/nicholasshirley/received_events","type":"User","site_admin":false},"repo":{"id":121223653,"name":"rails","full_name":"nicholasshirley/rails","owner":{"login":"nicholasshirley","id":1556844,"avatar_url":"https://avatars2.githubusercontent.com/u/1556844?v=4","gravatar_id":"","url":"https://api.github.com/users/nicholasshirley","html_url":"https://github.com/nicholasshirley","followers_url":"https://api.github.com/users/nicholasshirley/followers","following_url":"https://api.github.com/users/nicholasshirley/following{/other_user}","gists_url":"https://api.github.com/users/nicholasshirley/gists{/gist_id}","starred_url":"https://api.github.com/users/nicholasshirley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicholasshirley/subscriptions","organizations_url":"https://api.github.com/users/nicholasshirley/orgs","repos_url":"https://api.github.com/users/nicholasshirley/repos","events_url":"https://api.github.com/users/nicholasshirley/events{/privacy}","received_events_url":"https://api.github.com/users/nicholasshirley/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nicholasshirley/rails","description":"Ruby on Rails","fork":true,"url":"https://api.github.com/repos/nicholasshirley/rails","forks_url":"https://api.github.com/repos/nicholasshirley/rails/forks","keys_url":"https://api.github.com/repos/nicholasshirley/rails/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nicholasshirley/rails/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nicholasshirley/rails/teams","hooks_url":"https://api.github.com/repos/nicholasshirley/rails/hooks","issue_events_url":"https://api.github.com/repos/nicholasshirley/rails/issues/events{/number}","events_url":"https://api.github.com/repos/nicholasshirley/rails/events","assignees_url":"https://api.github.com/repos/nicholasshirley/rails/assignees{/user}","branches_url":"https://api.github.com/repos/nicholasshirley/rails/branches{/branch}","tags_url":"https://api.github.com/repos/nicholasshirley/rails/tags","blobs_url":"https://api.github.com/repos/nicholasshirley/rails/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nicholasshirley/rails/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nicholasshirley/rails/git/refs{/sha}","trees_url":"https://api.github.com/repos/nicholasshirley/rails/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nicholasshirley/rails/statuses/{sha}","languages_url":"https://api.github.com/repos/nicholasshirley/rails/languages","stargazers_url":"https://api.github.com/repos/nicholasshirley/rails/stargazers","contributors_url":"https://api.github.com/repos/nicholasshirley/rails/contributors","subscribers_url":"https://api.github.com/repos/nicholasshirley/rails/subscribers","subscription_url":"https://api.github.com/repos/nicholasshirley/rails/subscription","commits_url":"https://api.github.com/repos/nicholasshirley/rails/commits{/sha}","git_commits_url":"https://api.github.com/repos/nicholasshirley/rails/git/commits{/sha}","comments_url":"https://api.github.com/repos/nicholasshirley/rails/comments{/number}","issue_comment_url":"https://api.github.com/repos/nicholasshirley/rails/issues/comments{/number}","contents_url":"https://api.github.com/repos/nicholasshirley/rails/contents/{+path}","compare_url":"https://api.github.com/repos/nicholasshirley/rails/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nicholasshirley/rails/merges","archive_url":"https://api.github.com/repos/nicholasshirley/rails/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nicholasshirley/rails/downloads","issues_url":"https://api.github.com/repos/nicholasshirley/rails/issues{/number}","pulls_url":"https://api.github.com/repos/nicholasshirley/rails/pulls{/number}","milestones_url":"https://api.github.com/repos/nicholasshirley/rails/milestones{/number}","notifications_url":"https://api.github.com/repos/nicholasshirley/rails/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nicholasshirley/rails/labels{/name}","releases_url":"https://api.github.com/repos/nicholasshirley/rails/releases{/id}","deployments_url":"https://api.github.com/repos/nicholasshirley/rails/deployments","created_at":"2018-02-12T09:02:11Z","updated_at":"2018-02-12T09:02:38Z","pushed_at":"2018-02-12T11:43:39Z","git_url":"git://github.com/nicholasshirley/rails.git","ssh_url":"git@github.com:nicholasshirley/rails.git","clone_url":"https://github.com/nicholasshirley/rails.git","svn_url":"https://github.com/nicholasshirley/rails","homepage":"http://rubyonrails.org","size":159084,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rails:master","ref":"master","sha":"4a17b26c6850dd0892dc0b58a6a3f1cce3169593","user":{"login":"rails","id":4223,"avatar_url":"https://avatars1.githubusercontent.com/u/4223?v=4","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://avatars1.githubusercontent.com/u/4223?v=4","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":"2018-02-12T11:42:36Z","pushed_at":"2018-02-12T06:37:26Z","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":159084,"stargazers_count":38599,"watchers_count":38599,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":15610,"mirror_url":null,"archived":false,"open_issues_count":1083,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":15610,"open_issues":1083,"watchers":38599,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rails/rails/pulls/31964"},"html":{"href":"https://github.com/rails/rails/pull/31964"},"issue":{"href":"https://api.github.com/repos/rails/rails/issues/31964"},"comments":{"href":"https://api.github.com/repos/rails/rails/issues/31964/comments"},"review_comments":{"href":"https://api.github.com/repos/rails/rails/pulls/31964/comments"},"review_comment":{"href":"https://api.github.com/repos/rails/rails/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rails/rails/pulls/31964/commits"},"statuses":{"href":"https://api.github.com/repos/rails/rails/statuses/1ab56e88ce1687772deb11a1e6e5f256b21a7e4a"}},"author_association":"NONE","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":true,"commits":2,"additions":7,"deletions":3,"changed_files":1}}
{"actor":{"display_login":"nicholasshirley"}}