{"action":"created","comment":{"url":"https://api.github.com/repos/nnh/eclipro/pulls/comments/150460535","pull_request_review_id":76011456,"id":150460535,"diff_hunk":"@@ -45,20 +45,17 @@ def create\n   def update\n     Protocol.transaction do\n       @protocol.assign_attributes(protocol_params)\n-      if has_change?\n-        @protocol.version += 0.001\n-        @protocol.save!\n+      if @protocol.has_changes_to_save?","path":"app/controllers/protocols_controller.rb","position":25,"original_position":25,"commit_id":"0b39aff4a49e528315e880eff8d420222a6a4f29","original_commit_id":"0b39aff4a49e528315e880eff8d420222a6a4f29","user":{"login":"katsusuke","id":624736,"avatar_url":"https://avatars0.githubusercontent.com/u/624736?v=4","gravatar_id":"","url":"https://api.github.com/users/katsusuke","html_url":"https://github.com/katsusuke","followers_url":"https://api.github.com/users/katsusuke/followers","following_url":"https://api.github.com/users/katsusuke/following{/other_user}","gists_url":"https://api.github.com/users/katsusuke/gists{/gist_id}","starred_url":"https://api.github.com/users/katsusuke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/katsusuke/subscriptions","organizations_url":"https://api.github.com/users/katsusuke/orgs","repos_url":"https://api.github.com/users/katsusuke/repos","events_url":"https://api.github.com/users/katsusuke/events{/privacy}","received_events_url":"https://api.github.com/users/katsusuke/received_events","type":"User","site_admin":false},"body":"うーんイマイチダサいなぁ・・・ attributeに変更があればバージョンアップっていうロジックは \r\n```\r\n@protocol.assign_attributes(protocol_params)\r\nmessage =\r\n  if @protocol.changes_to_save?\r\n    @protocol.versionup!\r\n    t('.success')\r\n  else\r\n    t('.no_change')\r\n  end\r\nredirect_to @protocol, notice: message\r\n```\r\n\r\nbefore_validate に突っ込んだほうが良いのかなぁ...\r\n理想\r\n```\r\ndef update\r\n  @protocol.assign_attributes(protocol_params)\r\n  @protocol.save! # ここで必要なら勝手にバージョンアップ\r\n  redirect_to @protocol, notice: @protocol.saved_changes? ? t('.success') : t('.no_change')\r\nrescue ActiveRecord::StaleObjectError => e\r\n  redirect_to @protocol, alert: t('.lock_error')\r\nrescue => e\r\n  redirect_to @protocol, alert: t('.failure')\r\nend\r\n```","created_at":"2017-11-13T07:14:32Z","updated_at":"2017-11-13T07:14:32Z","html_url":"https://github.com/nnh/eclipro/pull/11#discussion_r150460535","pull_request_url":"https://api.github.com/repos/nnh/eclipro/pulls/11","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/nnh/eclipro/pulls/comments/150460535"},"html":{"href":"https://github.com/nnh/eclipro/pull/11#discussion_r150460535"},"pull_request":{"href":"https://api.github.com/repos/nnh/eclipro/pulls/11"}},"in_reply_to_id":150455501},"pull_request":{"url":"https://api.github.com/repos/nnh/eclipro/pulls/11","id":150760102,"html_url":"https://github.com/nnh/eclipro/pull/11","diff_url":"https://github.com/nnh/eclipro/pull/11.diff","patch_url":"https://github.com/nnh/eclipro/pull/11.patch","issue_url":"https://api.github.com/repos/nnh/eclipro/issues/11","number":11,"state":"open","locked":false,"title":"Use s3","user":{"login":"R-Y","id":1785780,"avatar_url":"https://avatars1.githubusercontent.com/u/1785780?v=4","gravatar_id":"","url":"https://api.github.com/users/R-Y","html_url":"https://github.com/R-Y","followers_url":"https://api.github.com/users/R-Y/followers","following_url":"https://api.github.com/users/R-Y/following{/other_user}","gists_url":"https://api.github.com/users/R-Y/gists{/gist_id}","starred_url":"https://api.github.com/users/R-Y/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/R-Y/subscriptions","organizations_url":"https://api.github.com/users/R-Y/orgs","repos_url":"https://api.github.com/users/R-Y/repos","events_url":"https://api.github.com/users/R-Y/events{/privacy}","received_events_url":"https://api.github.com/users/R-Y/received_events","type":"User","site_admin":false},"body":"#9 \r\n\r\n- 画像の保存先をS3に変更\r\n- tinymce_assets_controllerをimages_controllerに変更、修正\r\n- 画像作成、読み込みの権限を追加\r\n- PDFエクスポートの修正\r\n\r\n@katsusuke \r\n確認をお願いします。","created_at":"2017-11-06T02:39:47Z","updated_at":"2017-11-13T07:14:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"63f8fdc555b27b60650dfc3715b1851a6468a953","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/nnh/eclipro/pulls/11/commits","review_comments_url":"https://api.github.com/repos/nnh/eclipro/pulls/11/comments","review_comment_url":"https://api.github.com/repos/nnh/eclipro/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nnh/eclipro/issues/11/comments","statuses_url":"https://api.github.com/repos/nnh/eclipro/statuses/0b39aff4a49e528315e880eff8d420222a6a4f29","head":{"label":"nnh:use_s3","ref":"use_s3","sha":"0b39aff4a49e528315e880eff8d420222a6a4f29","user":{"login":"nnh","id":4200169,"avatar_url":"https://avatars0.githubusercontent.com/u/4200169?v=4","gravatar_id":"","url":"https://api.github.com/users/nnh","html_url":"https://github.com/nnh","followers_url":"https://api.github.com/users/nnh/followers","following_url":"https://api.github.com/users/nnh/following{/other_user}","gists_url":"https://api.github.com/users/nnh/gists{/gist_id}","starred_url":"https://api.github.com/users/nnh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nnh/subscriptions","organizations_url":"https://api.github.com/users/nnh/orgs","repos_url":"https://api.github.com/users/nnh/repos","events_url":"https://api.github.com/users/nnh/events{/privacy}","received_events_url":"https://api.github.com/users/nnh/received_events","type":"Organization","site_admin":false},"repo":{"id":103790222,"name":"eclipro","full_name":"nnh/eclipro","owner":{"login":"nnh","id":4200169,"avatar_url":"https://avatars0.githubusercontent.com/u/4200169?v=4","gravatar_id":"","url":"https://api.github.com/users/nnh","html_url":"https://github.com/nnh","followers_url":"https://api.github.com/users/nnh/followers","following_url":"https://api.github.com/users/nnh/following{/other_user}","gists_url":"https://api.github.com/users/nnh/gists{/gist_id}","starred_url":"https://api.github.com/users/nnh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nnh/subscriptions","organizations_url":"https://api.github.com/users/nnh/orgs","repos_url":"https://api.github.com/users/nnh/repos","events_url":"https://api.github.com/users/nnh/events{/privacy}","received_events_url":"https://api.github.com/users/nnh/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nnh/eclipro","description":"e-clinical protocol (eclipro.com)","fork":false,"url":"https://api.github.com/repos/nnh/eclipro","forks_url":"https://api.github.com/repos/nnh/eclipro/forks","keys_url":"https://api.github.com/repos/nnh/eclipro/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nnh/eclipro/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nnh/eclipro/teams","hooks_url":"https://api.github.com/repos/nnh/eclipro/hooks","issue_events_url":"https://api.github.com/repos/nnh/eclipro/issues/events{/number}","events_url":"https://api.github.com/repos/nnh/eclipro/events","assignees_url":"https://api.github.com/repos/nnh/eclipro/assignees{/user}","branches_url":"https://api.github.com/repos/nnh/eclipro/branches{/branch}","tags_url":"https://api.github.com/repos/nnh/eclipro/tags","blobs_url":"https://api.github.com/repos/nnh/eclipro/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nnh/eclipro/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nnh/eclipro/git/refs{/sha}","trees_url":"https://api.github.com/repos/nnh/eclipro/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nnh/eclipro/statuses/{sha}","languages_url":"https://api.github.com/repos/nnh/eclipro/languages","stargazers_url":"https://api.github.com/repos/nnh/eclipro/stargazers","contributors_url":"https://api.github.com/repos/nnh/eclipro/contributors","subscribers_url":"https://api.github.com/repos/nnh/eclipro/subscribers","subscription_url":"https://api.github.com/repos/nnh/eclipro/subscription","commits_url":"https://api.github.com/repos/nnh/eclipro/commits{/sha}","git_commits_url":"https://api.github.com/repos/nnh/eclipro/git/commits{/sha}","comments_url":"https://api.github.com/repos/nnh/eclipro/comments{/number}","issue_comment_url":"https://api.github.com/repos/nnh/eclipro/issues/comments{/number}","contents_url":"https://api.github.com/repos/nnh/eclipro/contents/{+path}","compare_url":"https://api.github.com/repos/nnh/eclipro/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nnh/eclipro/merges","archive_url":"https://api.github.com/repos/nnh/eclipro/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nnh/eclipro/downloads","issues_url":"https://api.github.com/repos/nnh/eclipro/issues{/number}","pulls_url":"https://api.github.com/repos/nnh/eclipro/pulls{/number}","milestones_url":"https://api.github.com/repos/nnh/eclipro/milestones{/number}","notifications_url":"https://api.github.com/repos/nnh/eclipro/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nnh/eclipro/labels{/name}","releases_url":"https://api.github.com/repos/nnh/eclipro/releases{/id}","deployments_url":"https://api.github.com/repos/nnh/eclipro/deployments","created_at":"2017-09-16T23:27:48Z","updated_at":"2017-10-30T05:38:23Z","pushed_at":"2017-11-13T06:11:07Z","git_url":"git://github.com/nnh/eclipro.git","ssh_url":"git@github.com:nnh/eclipro.git","clone_url":"https://github.com/nnh/eclipro.git","svn_url":"https://github.com/nnh/eclipro","homepage":null,"size":4047,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":11,"forks":0,"open_issues":11,"watchers":2,"default_branch":"master"}},"base":{"label":"nnh:master","ref":"master","sha":"5387d27c92032473d4356e526358bab034270abe","user":{"login":"nnh","id":4200169,"avatar_url":"https://avatars0.githubusercontent.com/u/4200169?v=4","gravatar_id":"","url":"https://api.github.com/users/nnh","html_url":"https://github.com/nnh","followers_url":"https://api.github.com/users/nnh/followers","following_url":"https://api.github.com/users/nnh/following{/other_user}","gists_url":"https://api.github.com/users/nnh/gists{/gist_id}","starred_url":"https://api.github.com/users/nnh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nnh/subscriptions","organizations_url":"https://api.github.com/users/nnh/orgs","repos_url":"https://api.github.com/users/nnh/repos","events_url":"https://api.github.com/users/nnh/events{/privacy}","received_events_url":"https://api.github.com/users/nnh/received_events","type":"Organization","site_admin":false},"repo":{"id":103790222,"name":"eclipro","full_name":"nnh/eclipro","owner":{"login":"nnh","id":4200169,"avatar_url":"https://avatars0.githubusercontent.com/u/4200169?v=4","gravatar_id":"","url":"https://api.github.com/users/nnh","html_url":"https://github.com/nnh","followers_url":"https://api.github.com/users/nnh/followers","following_url":"https://api.github.com/users/nnh/following{/other_user}","gists_url":"https://api.github.com/users/nnh/gists{/gist_id}","starred_url":"https://api.github.com/users/nnh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nnh/subscriptions","organizations_url":"https://api.github.com/users/nnh/orgs","repos_url":"https://api.github.com/users/nnh/repos","events_url":"https://api.github.com/users/nnh/events{/privacy}","received_events_url":"https://api.github.com/users/nnh/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nnh/eclipro","description":"e-clinical protocol (eclipro.com)","fork":false,"url":"https://api.github.com/repos/nnh/eclipro","forks_url":"https://api.github.com/repos/nnh/eclipro/forks","keys_url":"https://api.github.com/repos/nnh/eclipro/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nnh/eclipro/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nnh/eclipro/teams","hooks_url":"https://api.github.com/repos/nnh/eclipro/hooks","issue_events_url":"https://api.github.com/repos/nnh/eclipro/issues/events{/number}","events_url":"https://api.github.com/repos/nnh/eclipro/events","assignees_url":"https://api.github.com/repos/nnh/eclipro/assignees{/user}","branches_url":"https://api.github.com/repos/nnh/eclipro/branches{/branch}","tags_url":"https://api.github.com/repos/nnh/eclipro/tags","blobs_url":"https://api.github.com/repos/nnh/eclipro/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nnh/eclipro/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nnh/eclipro/git/refs{/sha}","trees_url":"https://api.github.com/repos/nnh/eclipro/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nnh/eclipro/statuses/{sha}","languages_url":"https://api.github.com/repos/nnh/eclipro/languages","stargazers_url":"https://api.github.com/repos/nnh/eclipro/stargazers","contributors_url":"https://api.github.com/repos/nnh/eclipro/contributors","subscribers_url":"https://api.github.com/repos/nnh/eclipro/subscribers","subscription_url":"https://api.github.com/repos/nnh/eclipro/subscription","commits_url":"https://api.github.com/repos/nnh/eclipro/commits{/sha}","git_commits_url":"https://api.github.com/repos/nnh/eclipro/git/commits{/sha}","comments_url":"https://api.github.com/repos/nnh/eclipro/comments{/number}","issue_comment_url":"https://api.github.com/repos/nnh/eclipro/issues/comments{/number}","contents_url":"https://api.github.com/repos/nnh/eclipro/contents/{+path}","compare_url":"https://api.github.com/repos/nnh/eclipro/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nnh/eclipro/merges","archive_url":"https://api.github.com/repos/nnh/eclipro/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nnh/eclipro/downloads","issues_url":"https://api.github.com/repos/nnh/eclipro/issues{/number}","pulls_url":"https://api.github.com/repos/nnh/eclipro/pulls{/number}","milestones_url":"https://api.github.com/repos/nnh/eclipro/milestones{/number}","notifications_url":"https://api.github.com/repos/nnh/eclipro/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nnh/eclipro/labels{/name}","releases_url":"https://api.github.com/repos/nnh/eclipro/releases{/id}","deployments_url":"https://api.github.com/repos/nnh/eclipro/deployments","created_at":"2017-09-16T23:27:48Z","updated_at":"2017-10-30T05:38:23Z","pushed_at":"2017-11-13T06:11:07Z","git_url":"git://github.com/nnh/eclipro.git","ssh_url":"git@github.com:nnh/eclipro.git","clone_url":"https://github.com/nnh/eclipro.git","svn_url":"https://github.com/nnh/eclipro","homepage":null,"size":4047,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":11,"forks":0,"open_issues":11,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nnh/eclipro/pulls/11"},"html":{"href":"https://github.com/nnh/eclipro/pull/11"},"issue":{"href":"https://api.github.com/repos/nnh/eclipro/issues/11"},"comments":{"href":"https://api.github.com/repos/nnh/eclipro/issues/11/comments"},"review_comments":{"href":"https://api.github.com/repos/nnh/eclipro/pulls/11/comments"},"review_comment":{"href":"https://api.github.com/repos/nnh/eclipro/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nnh/eclipro/pulls/11/commits"},"statuses":{"href":"https://api.github.com/repos/nnh/eclipro/statuses/0b39aff4a49e528315e880eff8d420222a6a4f29"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"katsusuke"}}