{"action":"created","comment":{"url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/pulls/comments/224338754","pull_request_review_id":163677167,"id":224338754,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNDMzODc1NA==","diff_hunk":"@@ -1,3 +1,15 @@\n class Answer < ApplicationRecord\n+  MAX_NUM_ANSWERS = 4\n+\n   belongs_to :question\n+\n+  scope :correct, -> { where(correct: true) }\n+\n+  validates :body, presence: true\n+  validate :validate_number_of_answers\n+\n+  def validate_number_of_answers\n+    return unless question.answers.size >= MAX_NUM_ANSWERS\n+    errors.add(:question_id, \"There is already maximum number of questions (#{MAX_NUM_ANSWERS})\")","path":"app/models/answer.rb","position":null,"original_position":13,"commit_id":"8b1ee2f0653c068d63ebad738a86c0f8be8f5a23","original_commit_id":"e4682a62400b26b0715462a18e8bd73571e4be1d","user":{"login":"iBublik","id":11278497,"node_id":"MDQ6VXNlcjExMjc4NDk3","avatar_url":"https://avatars1.githubusercontent.com/u/11278497?v=4","gravatar_id":"","url":"https://api.github.com/users/iBublik","html_url":"https://github.com/iBublik","followers_url":"https://api.github.com/users/iBublik/followers","following_url":"https://api.github.com/users/iBublik/following{/other_user}","gists_url":"https://api.github.com/users/iBublik/gists{/gist_id}","starred_url":"https://api.github.com/users/iBublik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iBublik/subscriptions","organizations_url":"https://api.github.com/users/iBublik/orgs","repos_url":"https://api.github.com/users/iBublik/repos","events_url":"https://api.github.com/users/iBublik/events{/privacy}","received_events_url":"https://api.github.com/users/iBublik/received_events","type":"User","site_admin":false},"body":"Вопрос - это тоже атрибут модели, просто он виртуальный (т.е. не хранится физически в базе, а вычисляется на основе других атрибутов)","created_at":"2018-10-11T07:16:44Z","updated_at":"2018-10-11T07:16:44Z","html_url":"https://github.com/k-gavrilov/ror_basic_test-guru/pull/5#discussion_r224338754","pull_request_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/pulls/5","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/pulls/comments/224338754"},"html":{"href":"https://github.com/k-gavrilov/ror_basic_test-guru/pull/5#discussion_r224338754"},"pull_request":{"href":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/pulls/5"}},"in_reply_to_id":223646732},"pull_request":{"url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/pulls/5","id":221188444,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIxMTg4NDQ0","html_url":"https://github.com/k-gavrilov/ror_basic_test-guru/pull/5","diff_url":"https://github.com/k-gavrilov/ror_basic_test-guru/pull/5.diff","patch_url":"https://github.com/k-gavrilov/ror_basic_test-guru/pull/5.patch","issue_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/issues/5","number":5,"state":"open","locked":false,"title":"Implementation for Thinknetica RoR basic part 6","user":{"login":"k-gavrilov","id":41306104,"node_id":"MDQ6VXNlcjQxMzA2MTA0","avatar_url":"https://avatars3.githubusercontent.com/u/41306104?v=4","gravatar_id":"","url":"https://api.github.com/users/k-gavrilov","html_url":"https://github.com/k-gavrilov","followers_url":"https://api.github.com/users/k-gavrilov/followers","following_url":"https://api.github.com/users/k-gavrilov/following{/other_user}","gists_url":"https://api.github.com/users/k-gavrilov/gists{/gist_id}","starred_url":"https://api.github.com/users/k-gavrilov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/k-gavrilov/subscriptions","organizations_url":"https://api.github.com/users/k-gavrilov/orgs","repos_url":"https://api.github.com/users/k-gavrilov/repos","events_url":"https://api.github.com/users/k-gavrilov/events{/privacy}","received_events_url":"https://api.github.com/users/k-gavrilov/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-10-08T17:18:13Z","updated_at":"2018-10-11T07:16:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4acc72b817c9686abdc8bfcf5afab4aaf765fc02","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/pulls/5/commits","review_comments_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/pulls/5/comments","review_comment_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/pulls/comments{/number}","comments_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/issues/5/comments","statuses_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/statuses/8b1ee2f0653c068d63ebad738a86c0f8be8f5a23","head":{"label":"k-gavrilov:ror_basic_ex6","ref":"ror_basic_ex6","sha":"8b1ee2f0653c068d63ebad738a86c0f8be8f5a23","user":{"login":"k-gavrilov","id":41306104,"node_id":"MDQ6VXNlcjQxMzA2MTA0","avatar_url":"https://avatars3.githubusercontent.com/u/41306104?v=4","gravatar_id":"","url":"https://api.github.com/users/k-gavrilov","html_url":"https://github.com/k-gavrilov","followers_url":"https://api.github.com/users/k-gavrilov/followers","following_url":"https://api.github.com/users/k-gavrilov/following{/other_user}","gists_url":"https://api.github.com/users/k-gavrilov/gists{/gist_id}","starred_url":"https://api.github.com/users/k-gavrilov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/k-gavrilov/subscriptions","organizations_url":"https://api.github.com/users/k-gavrilov/orgs","repos_url":"https://api.github.com/users/k-gavrilov/repos","events_url":"https://api.github.com/users/k-gavrilov/events{/privacy}","received_events_url":"https://api.github.com/users/k-gavrilov/received_events","type":"User","site_admin":false},"repo":{"id":147925730,"node_id":"MDEwOlJlcG9zaXRvcnkxNDc5MjU3MzA=","name":"ror_basic_test-guru","full_name":"k-gavrilov/ror_basic_test-guru","private":false,"owner":{"login":"k-gavrilov","id":41306104,"node_id":"MDQ6VXNlcjQxMzA2MTA0","avatar_url":"https://avatars3.githubusercontent.com/u/41306104?v=4","gravatar_id":"","url":"https://api.github.com/users/k-gavrilov","html_url":"https://github.com/k-gavrilov","followers_url":"https://api.github.com/users/k-gavrilov/followers","following_url":"https://api.github.com/users/k-gavrilov/following{/other_user}","gists_url":"https://api.github.com/users/k-gavrilov/gists{/gist_id}","starred_url":"https://api.github.com/users/k-gavrilov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/k-gavrilov/subscriptions","organizations_url":"https://api.github.com/users/k-gavrilov/orgs","repos_url":"https://api.github.com/users/k-gavrilov/repos","events_url":"https://api.github.com/users/k-gavrilov/events{/privacy}","received_events_url":"https://api.github.com/users/k-gavrilov/received_events","type":"User","site_admin":false},"html_url":"https://github.com/k-gavrilov/ror_basic_test-guru","description":null,"fork":false,"url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru","forks_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/forks","keys_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/keys{/key_id}","collaborators_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/teams","hooks_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/hooks","issue_events_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/issues/events{/number}","events_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/events","assignees_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/assignees{/user}","branches_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/branches{/branch}","tags_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/tags","blobs_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/git/refs{/sha}","trees_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/git/trees{/sha}","statuses_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/statuses/{sha}","languages_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/languages","stargazers_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/stargazers","contributors_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/contributors","subscribers_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/subscribers","subscription_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/subscription","commits_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/commits{/sha}","git_commits_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/git/commits{/sha}","comments_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/comments{/number}","issue_comment_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/issues/comments{/number}","contents_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/contents/{+path}","compare_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/compare/{base}...{head}","merges_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/merges","archive_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/downloads","issues_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/issues{/number}","pulls_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/pulls{/number}","milestones_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/milestones{/number}","notifications_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/labels{/name}","releases_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/releases{/id}","deployments_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/deployments","created_at":"2018-09-08T10:59:08Z","updated_at":"2018-10-04T17:36:34Z","pushed_at":"2018-10-11T06:06:09Z","git_url":"git://github.com/k-gavrilov/ror_basic_test-guru.git","ssh_url":"git@github.com:k-gavrilov/ror_basic_test-guru.git","clone_url":"https://github.com/k-gavrilov/ror_basic_test-guru.git","svn_url":"https://github.com/k-gavrilov/ror_basic_test-guru","homepage":null,"size":292,"stargazers_count":0,"watchers_count":0,"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":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"k-gavrilov:master","ref":"master","sha":"353932da1608494f687b6bb37c009c4caa65803e","user":{"login":"k-gavrilov","id":41306104,"node_id":"MDQ6VXNlcjQxMzA2MTA0","avatar_url":"https://avatars3.githubusercontent.com/u/41306104?v=4","gravatar_id":"","url":"https://api.github.com/users/k-gavrilov","html_url":"https://github.com/k-gavrilov","followers_url":"https://api.github.com/users/k-gavrilov/followers","following_url":"https://api.github.com/users/k-gavrilov/following{/other_user}","gists_url":"https://api.github.com/users/k-gavrilov/gists{/gist_id}","starred_url":"https://api.github.com/users/k-gavrilov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/k-gavrilov/subscriptions","organizations_url":"https://api.github.com/users/k-gavrilov/orgs","repos_url":"https://api.github.com/users/k-gavrilov/repos","events_url":"https://api.github.com/users/k-gavrilov/events{/privacy}","received_events_url":"https://api.github.com/users/k-gavrilov/received_events","type":"User","site_admin":false},"repo":{"id":147925730,"node_id":"MDEwOlJlcG9zaXRvcnkxNDc5MjU3MzA=","name":"ror_basic_test-guru","full_name":"k-gavrilov/ror_basic_test-guru","private":false,"owner":{"login":"k-gavrilov","id":41306104,"node_id":"MDQ6VXNlcjQxMzA2MTA0","avatar_url":"https://avatars3.githubusercontent.com/u/41306104?v=4","gravatar_id":"","url":"https://api.github.com/users/k-gavrilov","html_url":"https://github.com/k-gavrilov","followers_url":"https://api.github.com/users/k-gavrilov/followers","following_url":"https://api.github.com/users/k-gavrilov/following{/other_user}","gists_url":"https://api.github.com/users/k-gavrilov/gists{/gist_id}","starred_url":"https://api.github.com/users/k-gavrilov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/k-gavrilov/subscriptions","organizations_url":"https://api.github.com/users/k-gavrilov/orgs","repos_url":"https://api.github.com/users/k-gavrilov/repos","events_url":"https://api.github.com/users/k-gavrilov/events{/privacy}","received_events_url":"https://api.github.com/users/k-gavrilov/received_events","type":"User","site_admin":false},"html_url":"https://github.com/k-gavrilov/ror_basic_test-guru","description":null,"fork":false,"url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru","forks_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/forks","keys_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/keys{/key_id}","collaborators_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/teams","hooks_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/hooks","issue_events_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/issues/events{/number}","events_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/events","assignees_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/assignees{/user}","branches_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/branches{/branch}","tags_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/tags","blobs_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/git/refs{/sha}","trees_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/git/trees{/sha}","statuses_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/statuses/{sha}","languages_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/languages","stargazers_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/stargazers","contributors_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/contributors","subscribers_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/subscribers","subscription_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/subscription","commits_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/commits{/sha}","git_commits_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/git/commits{/sha}","comments_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/comments{/number}","issue_comment_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/issues/comments{/number}","contents_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/contents/{+path}","compare_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/compare/{base}...{head}","merges_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/merges","archive_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/downloads","issues_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/issues{/number}","pulls_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/pulls{/number}","milestones_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/milestones{/number}","notifications_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/labels{/name}","releases_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/releases{/id}","deployments_url":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/deployments","created_at":"2018-09-08T10:59:08Z","updated_at":"2018-10-04T17:36:34Z","pushed_at":"2018-10-11T06:06:09Z","git_url":"git://github.com/k-gavrilov/ror_basic_test-guru.git","ssh_url":"git@github.com:k-gavrilov/ror_basic_test-guru.git","clone_url":"https://github.com/k-gavrilov/ror_basic_test-guru.git","svn_url":"https://github.com/k-gavrilov/ror_basic_test-guru","homepage":null,"size":292,"stargazers_count":0,"watchers_count":0,"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":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/pulls/5"},"html":{"href":"https://github.com/k-gavrilov/ror_basic_test-guru/pull/5"},"issue":{"href":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/issues/5"},"comments":{"href":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/k-gavrilov/ror_basic_test-guru/statuses/8b1ee2f0653c068d63ebad738a86c0f8be8f5a23"}},"author_association":"OWNER"}}
{"actor":{"display_login":"iBublik"}}