{"action":"created","comment":{"url":"https://api.github.com/repos/speee/webapp-revieee/pulls/comments/99983891","pull_request_review_id":20675156,"id":99983891,"diff_hunk":"@@ -0,0 +1,17 @@\n+class Endpoint < ApplicationRecord\n+  IP_REGEXP = /\\A(([1-9]?[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]).){3}([1-9]?[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\z/.freeze\n+  SUBDOMAIN_PREFIX = 'endpoint'.freeze\n+\n+  belongs_to :task\n+\n+  validates :ip, presence: true, format: { with: IP_REGEXP }\n+  validates :port, presence: true, numericality: { only_integer: true, greater_than_or_equal_to: 0, less_than_or_equal_to: 65535 }","path":"app/models/endpoint.rb","position":8,"original_position":8,"commit_id":"6e0e58773e58efd5047a577a8ae8ddbc60d4ec48","original_commit_id":"6e0e58773e58efd5047a577a8ae8ddbc60d4ec48","user":{"login":"selmertsx","id":1563239,"avatar_url":"https://avatars.githubusercontent.com/u/1563239?v=3","gravatar_id":"","url":"https://api.github.com/users/selmertsx","html_url":"https://github.com/selmertsx","followers_url":"https://api.github.com/users/selmertsx/followers","following_url":"https://api.github.com/users/selmertsx/following{/other_user}","gists_url":"https://api.github.com/users/selmertsx/gists{/gist_id}","starred_url":"https://api.github.com/users/selmertsx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/selmertsx/subscriptions","organizations_url":"https://api.github.com/users/selmertsx/orgs","repos_url":"https://api.github.com/users/selmertsx/repos","events_url":"https://api.github.com/users/selmertsx/events{/privacy}","received_events_url":"https://api.github.com/users/selmertsx/received_events","type":"User","site_admin":false},"body":"ここ悩ましいですよね...\r\n\r\ndb側で unsigned int や null:false 指定をしているので、ここで `only_integer: true, greater_than_or_equal_to` や `presence: true` を挟む必要は無いのではないかとも思ったりします。理由としては、下記のとおりです。\r\n\r\n- 不要なvalidation をかます分だけ速度が遅くなる\r\n- これが書かれていると、db側で制御してないのか？と不安になったりする。（僕だけかも？）\r\n- schemaとmodelのどちらか一方を修正したときに、もう一方を修正し忘れて事故ることがある\r\n\r\nそれに対して、validatesを明示的にしたい理由もわかります。\r\n\r\n- modelを見ただけでどのようなデータが求められているのか、一目で分かる。\r\n- 速度もそこまで求められていない。\r\n\r\nちょっと僕も悩んでいる内容ですので、@kou さんの意見もお伺いしたいです！\r\n","created_at":"2017-02-08T03:09:27Z","updated_at":"2017-02-08T03:09:27Z","html_url":"https://github.com/speee/webapp-revieee/pull/15#discussion_r99983891","pull_request_url":"https://api.github.com/repos/speee/webapp-revieee/pulls/15","_links":{"self":{"href":"https://api.github.com/repos/speee/webapp-revieee/pulls/comments/99983891"},"html":{"href":"https://github.com/speee/webapp-revieee/pull/15#discussion_r99983891"},"pull_request":{"href":"https://api.github.com/repos/speee/webapp-revieee/pulls/15"}}},"pull_request":{"url":"https://api.github.com/repos/speee/webapp-revieee/pulls/15","id":104118347,"html_url":"https://github.com/speee/webapp-revieee/pull/15","diff_url":"https://github.com/speee/webapp-revieee/pull/15.diff","patch_url":"https://github.com/speee/webapp-revieee/pull/15.patch","issue_url":"https://api.github.com/repos/speee/webapp-revieee/issues/15","number":15,"state":"open","locked":false,"title":"multiple port publication","user":{"login":"pataiji","id":1869952,"avatar_url":"https://avatars.githubusercontent.com/u/1869952?v=3","gravatar_id":"","url":"https://api.github.com/users/pataiji","html_url":"https://github.com/pataiji","followers_url":"https://api.github.com/users/pataiji/followers","following_url":"https://api.github.com/users/pataiji/following{/other_user}","gists_url":"https://api.github.com/users/pataiji/gists{/gist_id}","starred_url":"https://api.github.com/users/pataiji/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pataiji/subscriptions","organizations_url":"https://api.github.com/users/pataiji/orgs","repos_url":"https://api.github.com/users/pataiji/repos","events_url":"https://api.github.com/users/pataiji/events{/privacy}","received_events_url":"https://api.github.com/users/pataiji/received_events","type":"User","site_admin":false},"body":"issue #4","created_at":"2017-02-01T11:27:43Z","updated_at":"2017-02-08T03:09:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8c1570457c44aded6444356a38b102717e2bc640","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/speee/webapp-revieee/pulls/15/commits","review_comments_url":"https://api.github.com/repos/speee/webapp-revieee/pulls/15/comments","review_comment_url":"https://api.github.com/repos/speee/webapp-revieee/pulls/comments{/number}","comments_url":"https://api.github.com/repos/speee/webapp-revieee/issues/15/comments","statuses_url":"https://api.github.com/repos/speee/webapp-revieee/statuses/6e0e58773e58efd5047a577a8ae8ddbc60d4ec48","head":{"label":"speee:4-multiple-port-publication","ref":"4-multiple-port-publication","sha":"6e0e58773e58efd5047a577a8ae8ddbc60d4ec48","user":{"login":"speee","id":12638362,"avatar_url":"https://avatars.githubusercontent.com/u/12638362?v=3","gravatar_id":"","url":"https://api.github.com/users/speee","html_url":"https://github.com/speee","followers_url":"https://api.github.com/users/speee/followers","following_url":"https://api.github.com/users/speee/following{/other_user}","gists_url":"https://api.github.com/users/speee/gists{/gist_id}","starred_url":"https://api.github.com/users/speee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/speee/subscriptions","organizations_url":"https://api.github.com/users/speee/orgs","repos_url":"https://api.github.com/users/speee/repos","events_url":"https://api.github.com/users/speee/events{/privacy}","received_events_url":"https://api.github.com/users/speee/received_events","type":"Organization","site_admin":false},"repo":{"id":78603367,"name":"webapp-revieee","full_name":"speee/webapp-revieee","owner":{"login":"speee","id":12638362,"avatar_url":"https://avatars.githubusercontent.com/u/12638362?v=3","gravatar_id":"","url":"https://api.github.com/users/speee","html_url":"https://github.com/speee","followers_url":"https://api.github.com/users/speee/followers","following_url":"https://api.github.com/users/speee/following{/other_user}","gists_url":"https://api.github.com/users/speee/gists{/gist_id}","starred_url":"https://api.github.com/users/speee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/speee/subscriptions","organizations_url":"https://api.github.com/users/speee/orgs","repos_url":"https://api.github.com/users/speee/repos","events_url":"https://api.github.com/users/speee/events{/privacy}","received_events_url":"https://api.github.com/users/speee/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/speee/webapp-revieee","description":null,"fork":false,"url":"https://api.github.com/repos/speee/webapp-revieee","forks_url":"https://api.github.com/repos/speee/webapp-revieee/forks","keys_url":"https://api.github.com/repos/speee/webapp-revieee/keys{/key_id}","collaborators_url":"https://api.github.com/repos/speee/webapp-revieee/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/speee/webapp-revieee/teams","hooks_url":"https://api.github.com/repos/speee/webapp-revieee/hooks","issue_events_url":"https://api.github.com/repos/speee/webapp-revieee/issues/events{/number}","events_url":"https://api.github.com/repos/speee/webapp-revieee/events","assignees_url":"https://api.github.com/repos/speee/webapp-revieee/assignees{/user}","branches_url":"https://api.github.com/repos/speee/webapp-revieee/branches{/branch}","tags_url":"https://api.github.com/repos/speee/webapp-revieee/tags","blobs_url":"https://api.github.com/repos/speee/webapp-revieee/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/speee/webapp-revieee/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/speee/webapp-revieee/git/refs{/sha}","trees_url":"https://api.github.com/repos/speee/webapp-revieee/git/trees{/sha}","statuses_url":"https://api.github.com/repos/speee/webapp-revieee/statuses/{sha}","languages_url":"https://api.github.com/repos/speee/webapp-revieee/languages","stargazers_url":"https://api.github.com/repos/speee/webapp-revieee/stargazers","contributors_url":"https://api.github.com/repos/speee/webapp-revieee/contributors","subscribers_url":"https://api.github.com/repos/speee/webapp-revieee/subscribers","subscription_url":"https://api.github.com/repos/speee/webapp-revieee/subscription","commits_url":"https://api.github.com/repos/speee/webapp-revieee/commits{/sha}","git_commits_url":"https://api.github.com/repos/speee/webapp-revieee/git/commits{/sha}","comments_url":"https://api.github.com/repos/speee/webapp-revieee/comments{/number}","issue_comment_url":"https://api.github.com/repos/speee/webapp-revieee/issues/comments{/number}","contents_url":"https://api.github.com/repos/speee/webapp-revieee/contents/{+path}","compare_url":"https://api.github.com/repos/speee/webapp-revieee/compare/{base}...{head}","merges_url":"https://api.github.com/repos/speee/webapp-revieee/merges","archive_url":"https://api.github.com/repos/speee/webapp-revieee/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/speee/webapp-revieee/downloads","issues_url":"https://api.github.com/repos/speee/webapp-revieee/issues{/number}","pulls_url":"https://api.github.com/repos/speee/webapp-revieee/pulls{/number}","milestones_url":"https://api.github.com/repos/speee/webapp-revieee/milestones{/number}","notifications_url":"https://api.github.com/repos/speee/webapp-revieee/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/speee/webapp-revieee/labels{/name}","releases_url":"https://api.github.com/repos/speee/webapp-revieee/releases{/id}","deployments_url":"https://api.github.com/repos/speee/webapp-revieee/deployments","created_at":"2017-01-11T04:41:46Z","updated_at":"2017-02-01T03:49:07Z","pushed_at":"2017-02-08T02:25:46Z","git_url":"git://github.com/speee/webapp-revieee.git","ssh_url":"git@github.com:speee/webapp-revieee.git","clone_url":"https://github.com/speee/webapp-revieee.git","svn_url":"https://github.com/speee/webapp-revieee","homepage":null,"size":40,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":10,"forks":0,"open_issues":10,"watchers":0,"default_branch":"master"}},"base":{"label":"speee:master","ref":"master","sha":"4f0e0e70fd90eafde7db7c05e08043a765f42515","user":{"login":"speee","id":12638362,"avatar_url":"https://avatars.githubusercontent.com/u/12638362?v=3","gravatar_id":"","url":"https://api.github.com/users/speee","html_url":"https://github.com/speee","followers_url":"https://api.github.com/users/speee/followers","following_url":"https://api.github.com/users/speee/following{/other_user}","gists_url":"https://api.github.com/users/speee/gists{/gist_id}","starred_url":"https://api.github.com/users/speee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/speee/subscriptions","organizations_url":"https://api.github.com/users/speee/orgs","repos_url":"https://api.github.com/users/speee/repos","events_url":"https://api.github.com/users/speee/events{/privacy}","received_events_url":"https://api.github.com/users/speee/received_events","type":"Organization","site_admin":false},"repo":{"id":78603367,"name":"webapp-revieee","full_name":"speee/webapp-revieee","owner":{"login":"speee","id":12638362,"avatar_url":"https://avatars.githubusercontent.com/u/12638362?v=3","gravatar_id":"","url":"https://api.github.com/users/speee","html_url":"https://github.com/speee","followers_url":"https://api.github.com/users/speee/followers","following_url":"https://api.github.com/users/speee/following{/other_user}","gists_url":"https://api.github.com/users/speee/gists{/gist_id}","starred_url":"https://api.github.com/users/speee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/speee/subscriptions","organizations_url":"https://api.github.com/users/speee/orgs","repos_url":"https://api.github.com/users/speee/repos","events_url":"https://api.github.com/users/speee/events{/privacy}","received_events_url":"https://api.github.com/users/speee/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/speee/webapp-revieee","description":null,"fork":false,"url":"https://api.github.com/repos/speee/webapp-revieee","forks_url":"https://api.github.com/repos/speee/webapp-revieee/forks","keys_url":"https://api.github.com/repos/speee/webapp-revieee/keys{/key_id}","collaborators_url":"https://api.github.com/repos/speee/webapp-revieee/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/speee/webapp-revieee/teams","hooks_url":"https://api.github.com/repos/speee/webapp-revieee/hooks","issue_events_url":"https://api.github.com/repos/speee/webapp-revieee/issues/events{/number}","events_url":"https://api.github.com/repos/speee/webapp-revieee/events","assignees_url":"https://api.github.com/repos/speee/webapp-revieee/assignees{/user}","branches_url":"https://api.github.com/repos/speee/webapp-revieee/branches{/branch}","tags_url":"https://api.github.com/repos/speee/webapp-revieee/tags","blobs_url":"https://api.github.com/repos/speee/webapp-revieee/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/speee/webapp-revieee/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/speee/webapp-revieee/git/refs{/sha}","trees_url":"https://api.github.com/repos/speee/webapp-revieee/git/trees{/sha}","statuses_url":"https://api.github.com/repos/speee/webapp-revieee/statuses/{sha}","languages_url":"https://api.github.com/repos/speee/webapp-revieee/languages","stargazers_url":"https://api.github.com/repos/speee/webapp-revieee/stargazers","contributors_url":"https://api.github.com/repos/speee/webapp-revieee/contributors","subscribers_url":"https://api.github.com/repos/speee/webapp-revieee/subscribers","subscription_url":"https://api.github.com/repos/speee/webapp-revieee/subscription","commits_url":"https://api.github.com/repos/speee/webapp-revieee/commits{/sha}","git_commits_url":"https://api.github.com/repos/speee/webapp-revieee/git/commits{/sha}","comments_url":"https://api.github.com/repos/speee/webapp-revieee/comments{/number}","issue_comment_url":"https://api.github.com/repos/speee/webapp-revieee/issues/comments{/number}","contents_url":"https://api.github.com/repos/speee/webapp-revieee/contents/{+path}","compare_url":"https://api.github.com/repos/speee/webapp-revieee/compare/{base}...{head}","merges_url":"https://api.github.com/repos/speee/webapp-revieee/merges","archive_url":"https://api.github.com/repos/speee/webapp-revieee/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/speee/webapp-revieee/downloads","issues_url":"https://api.github.com/repos/speee/webapp-revieee/issues{/number}","pulls_url":"https://api.github.com/repos/speee/webapp-revieee/pulls{/number}","milestones_url":"https://api.github.com/repos/speee/webapp-revieee/milestones{/number}","notifications_url":"https://api.github.com/repos/speee/webapp-revieee/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/speee/webapp-revieee/labels{/name}","releases_url":"https://api.github.com/repos/speee/webapp-revieee/releases{/id}","deployments_url":"https://api.github.com/repos/speee/webapp-revieee/deployments","created_at":"2017-01-11T04:41:46Z","updated_at":"2017-02-01T03:49:07Z","pushed_at":"2017-02-08T02:25:46Z","git_url":"git://github.com/speee/webapp-revieee.git","ssh_url":"git@github.com:speee/webapp-revieee.git","clone_url":"https://github.com/speee/webapp-revieee.git","svn_url":"https://github.com/speee/webapp-revieee","homepage":null,"size":40,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":10,"forks":0,"open_issues":10,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/speee/webapp-revieee/pulls/15"},"html":{"href":"https://github.com/speee/webapp-revieee/pull/15"},"issue":{"href":"https://api.github.com/repos/speee/webapp-revieee/issues/15"},"comments":{"href":"https://api.github.com/repos/speee/webapp-revieee/issues/15/comments"},"review_comments":{"href":"https://api.github.com/repos/speee/webapp-revieee/pulls/15/comments"},"review_comment":{"href":"https://api.github.com/repos/speee/webapp-revieee/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/speee/webapp-revieee/pulls/15/commits"},"statuses":{"href":"https://api.github.com/repos/speee/webapp-revieee/statuses/6e0e58773e58efd5047a577a8ae8ddbc60d4ec48"}}}}
{"actor":{"display_login":"selmertsx"}}