{"action":"created","comment":{"url":"https://api.github.com/repos/siblis/cwc-back/pulls/comments/231630105","pull_request_review_id":172638712,"id":231630105,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMTYzMDEwNQ==","diff_hunk":"@@ -0,0 +1,60 @@\n+module Api::V1\n+  class ProjectsController < ApplicationController\n+    \n+    def index\n+      @projects = Project.all\n+      render json: @projects\n+    end\n+\n+    def create\n+      @project = Project.new(project_params)\n+      if @project.save\n+        render status: :created\n+      else\n+        render json: @project.errors, status: :unprocessable_entity\n+      end\n+    end\n+    \n+    def show\n+      @project = Project.find(params[:id])\n+      if @project\n+        render json: @project\n+      else\n+        render json: {project: \"not found\"}, status: :not_found","path":"app/controllers/api/v1/projects_controller.rb","position":23,"original_position":23,"commit_id":"05ba1c93dff055b65b55c57a1ead57455dc017d6","original_commit_id":"05ba1c93dff055b65b55c57a1ead57455dc017d6","user":{"login":"igorsimdyanov","id":2901012,"node_id":"MDQ6VXNlcjI5MDEwMTI=","avatar_url":"https://avatars3.githubusercontent.com/u/2901012?v=4","gravatar_id":"","url":"https://api.github.com/users/igorsimdyanov","html_url":"https://github.com/igorsimdyanov","followers_url":"https://api.github.com/users/igorsimdyanov/followers","following_url":"https://api.github.com/users/igorsimdyanov/following{/other_user}","gists_url":"https://api.github.com/users/igorsimdyanov/gists{/gist_id}","starred_url":"https://api.github.com/users/igorsimdyanov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/igorsimdyanov/subscriptions","organizations_url":"https://api.github.com/users/igorsimdyanov/orgs","repos_url":"https://api.github.com/users/igorsimdyanov/repos","events_url":"https://api.github.com/users/igorsimdyanov/events{/privacy}","received_events_url":"https://api.github.com/users/igorsimdyanov/received_events","type":"User","site_admin":false},"body":"Эта строка никогда не выполнится и вообще if-проверка лишняя, так как если find не найдет запись - он сгенерирует исключение ActiveRecord::RecordNotFound. В продакшене это будет выглядеть как 404, в development - просто страница ошибки. Поэтому нужно либо убрать здесь if-проверку, либо если по соглашениям с front-разработкой тут должен быть 200-ый ответ, нужно выбрать другой способ извлечения данных из базы данных. Сам я голосую за 404\r\n```\r\n@project = Project.find(params[:id])\r\nrender json: @project\r\n```","created_at":"2018-11-07T18:45:29Z","updated_at":"2018-11-07T18:53:46Z","html_url":"https://github.com/siblis/cwc-back/pull/5#discussion_r231630105","pull_request_url":"https://api.github.com/repos/siblis/cwc-back/pulls/5","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/siblis/cwc-back/pulls/comments/231630105"},"html":{"href":"https://github.com/siblis/cwc-back/pull/5#discussion_r231630105"},"pull_request":{"href":"https://api.github.com/repos/siblis/cwc-back/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/siblis/cwc-back/pulls/5","id":229127208,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI5MTI3MjA4","html_url":"https://github.com/siblis/cwc-back/pull/5","diff_url":"https://github.com/siblis/cwc-back/pull/5.diff","patch_url":"https://github.com/siblis/cwc-back/pull/5.patch","issue_url":"https://api.github.com/repos/siblis/cwc-back/issues/5","number":5,"state":"open","locked":false,"title":"Модель и контроллер для проектов","user":{"login":"pvgtag","id":23311862,"node_id":"MDQ6VXNlcjIzMzExODYy","avatar_url":"https://avatars2.githubusercontent.com/u/23311862?v=4","gravatar_id":"","url":"https://api.github.com/users/pvgtag","html_url":"https://github.com/pvgtag","followers_url":"https://api.github.com/users/pvgtag/followers","following_url":"https://api.github.com/users/pvgtag/following{/other_user}","gists_url":"https://api.github.com/users/pvgtag/gists{/gist_id}","starred_url":"https://api.github.com/users/pvgtag/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pvgtag/subscriptions","organizations_url":"https://api.github.com/users/pvgtag/orgs","repos_url":"https://api.github.com/users/pvgtag/repos","events_url":"https://api.github.com/users/pvgtag/events{/privacy}","received_events_url":"https://api.github.com/users/pvgtag/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-11-07T18:34:45Z","updated_at":"2018-11-07T18:53:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f08f9b817c0c7a1d3f03f2b100c1ee43179af2e2","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/siblis/cwc-back/pulls/5/commits","review_comments_url":"https://api.github.com/repos/siblis/cwc-back/pulls/5/comments","review_comment_url":"https://api.github.com/repos/siblis/cwc-back/pulls/comments{/number}","comments_url":"https://api.github.com/repos/siblis/cwc-back/issues/5/comments","statuses_url":"https://api.github.com/repos/siblis/cwc-back/statuses/05ba1c93dff055b65b55c57a1ead57455dc017d6","head":{"label":"pvgtag:develop","ref":"develop","sha":"05ba1c93dff055b65b55c57a1ead57455dc017d6","user":{"login":"pvgtag","id":23311862,"node_id":"MDQ6VXNlcjIzMzExODYy","avatar_url":"https://avatars2.githubusercontent.com/u/23311862?v=4","gravatar_id":"","url":"https://api.github.com/users/pvgtag","html_url":"https://github.com/pvgtag","followers_url":"https://api.github.com/users/pvgtag/followers","following_url":"https://api.github.com/users/pvgtag/following{/other_user}","gists_url":"https://api.github.com/users/pvgtag/gists{/gist_id}","starred_url":"https://api.github.com/users/pvgtag/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pvgtag/subscriptions","organizations_url":"https://api.github.com/users/pvgtag/orgs","repos_url":"https://api.github.com/users/pvgtag/repos","events_url":"https://api.github.com/users/pvgtag/events{/privacy}","received_events_url":"https://api.github.com/users/pvgtag/received_events","type":"User","site_admin":false},"repo":{"id":156106751,"node_id":"MDEwOlJlcG9zaXRvcnkxNTYxMDY3NTE=","name":"cwc-back","full_name":"pvgtag/cwc-back","private":false,"owner":{"login":"pvgtag","id":23311862,"node_id":"MDQ6VXNlcjIzMzExODYy","avatar_url":"https://avatars2.githubusercontent.com/u/23311862?v=4","gravatar_id":"","url":"https://api.github.com/users/pvgtag","html_url":"https://github.com/pvgtag","followers_url":"https://api.github.com/users/pvgtag/followers","following_url":"https://api.github.com/users/pvgtag/following{/other_user}","gists_url":"https://api.github.com/users/pvgtag/gists{/gist_id}","starred_url":"https://api.github.com/users/pvgtag/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pvgtag/subscriptions","organizations_url":"https://api.github.com/users/pvgtag/orgs","repos_url":"https://api.github.com/users/pvgtag/repos","events_url":"https://api.github.com/users/pvgtag/events{/privacy}","received_events_url":"https://api.github.com/users/pvgtag/received_events","type":"User","site_admin":false},"html_url":"https://github.com/pvgtag/cwc-back","description":"Бэкенд для курсового проекта по курсу \"Коллективная разработка на RoR\" от GeekBrains","fork":true,"url":"https://api.github.com/repos/pvgtag/cwc-back","forks_url":"https://api.github.com/repos/pvgtag/cwc-back/forks","keys_url":"https://api.github.com/repos/pvgtag/cwc-back/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pvgtag/cwc-back/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pvgtag/cwc-back/teams","hooks_url":"https://api.github.com/repos/pvgtag/cwc-back/hooks","issue_events_url":"https://api.github.com/repos/pvgtag/cwc-back/issues/events{/number}","events_url":"https://api.github.com/repos/pvgtag/cwc-back/events","assignees_url":"https://api.github.com/repos/pvgtag/cwc-back/assignees{/user}","branches_url":"https://api.github.com/repos/pvgtag/cwc-back/branches{/branch}","tags_url":"https://api.github.com/repos/pvgtag/cwc-back/tags","blobs_url":"https://api.github.com/repos/pvgtag/cwc-back/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pvgtag/cwc-back/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pvgtag/cwc-back/git/refs{/sha}","trees_url":"https://api.github.com/repos/pvgtag/cwc-back/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pvgtag/cwc-back/statuses/{sha}","languages_url":"https://api.github.com/repos/pvgtag/cwc-back/languages","stargazers_url":"https://api.github.com/repos/pvgtag/cwc-back/stargazers","contributors_url":"https://api.github.com/repos/pvgtag/cwc-back/contributors","subscribers_url":"https://api.github.com/repos/pvgtag/cwc-back/subscribers","subscription_url":"https://api.github.com/repos/pvgtag/cwc-back/subscription","commits_url":"https://api.github.com/repos/pvgtag/cwc-back/commits{/sha}","git_commits_url":"https://api.github.com/repos/pvgtag/cwc-back/git/commits{/sha}","comments_url":"https://api.github.com/repos/pvgtag/cwc-back/comments{/number}","issue_comment_url":"https://api.github.com/repos/pvgtag/cwc-back/issues/comments{/number}","contents_url":"https://api.github.com/repos/pvgtag/cwc-back/contents/{+path}","compare_url":"https://api.github.com/repos/pvgtag/cwc-back/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pvgtag/cwc-back/merges","archive_url":"https://api.github.com/repos/pvgtag/cwc-back/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pvgtag/cwc-back/downloads","issues_url":"https://api.github.com/repos/pvgtag/cwc-back/issues{/number}","pulls_url":"https://api.github.com/repos/pvgtag/cwc-back/pulls{/number}","milestones_url":"https://api.github.com/repos/pvgtag/cwc-back/milestones{/number}","notifications_url":"https://api.github.com/repos/pvgtag/cwc-back/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pvgtag/cwc-back/labels{/name}","releases_url":"https://api.github.com/repos/pvgtag/cwc-back/releases{/id}","deployments_url":"https://api.github.com/repos/pvgtag/cwc-back/deployments","created_at":"2018-11-04T17:23:49Z","updated_at":"2018-11-05T14:55:32Z","pushed_at":"2018-11-07T18:32:58Z","git_url":"git://github.com/pvgtag/cwc-back.git","ssh_url":"git@github.com:pvgtag/cwc-back.git","clone_url":"https://github.com/pvgtag/cwc-back.git","svn_url":"https://github.com/pvgtag/cwc-back","homepage":"","size":42,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"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":"siblis:develop","ref":"develop","sha":"a959d20d5549b874940b3f473e1384740bd998c6","user":{"login":"siblis","id":9503304,"node_id":"MDQ6VXNlcjk1MDMzMDQ=","avatar_url":"https://avatars0.githubusercontent.com/u/9503304?v=4","gravatar_id":"","url":"https://api.github.com/users/siblis","html_url":"https://github.com/siblis","followers_url":"https://api.github.com/users/siblis/followers","following_url":"https://api.github.com/users/siblis/following{/other_user}","gists_url":"https://api.github.com/users/siblis/gists{/gist_id}","starred_url":"https://api.github.com/users/siblis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/siblis/subscriptions","organizations_url":"https://api.github.com/users/siblis/orgs","repos_url":"https://api.github.com/users/siblis/repos","events_url":"https://api.github.com/users/siblis/events{/privacy}","received_events_url":"https://api.github.com/users/siblis/received_events","type":"User","site_admin":false},"repo":{"id":156103632,"node_id":"MDEwOlJlcG9zaXRvcnkxNTYxMDM2MzI=","name":"cwc-back","full_name":"siblis/cwc-back","private":false,"owner":{"login":"siblis","id":9503304,"node_id":"MDQ6VXNlcjk1MDMzMDQ=","avatar_url":"https://avatars0.githubusercontent.com/u/9503304?v=4","gravatar_id":"","url":"https://api.github.com/users/siblis","html_url":"https://github.com/siblis","followers_url":"https://api.github.com/users/siblis/followers","following_url":"https://api.github.com/users/siblis/following{/other_user}","gists_url":"https://api.github.com/users/siblis/gists{/gist_id}","starred_url":"https://api.github.com/users/siblis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/siblis/subscriptions","organizations_url":"https://api.github.com/users/siblis/orgs","repos_url":"https://api.github.com/users/siblis/repos","events_url":"https://api.github.com/users/siblis/events{/privacy}","received_events_url":"https://api.github.com/users/siblis/received_events","type":"User","site_admin":false},"html_url":"https://github.com/siblis/cwc-back","description":null,"fork":false,"url":"https://api.github.com/repos/siblis/cwc-back","forks_url":"https://api.github.com/repos/siblis/cwc-back/forks","keys_url":"https://api.github.com/repos/siblis/cwc-back/keys{/key_id}","collaborators_url":"https://api.github.com/repos/siblis/cwc-back/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/siblis/cwc-back/teams","hooks_url":"https://api.github.com/repos/siblis/cwc-back/hooks","issue_events_url":"https://api.github.com/repos/siblis/cwc-back/issues/events{/number}","events_url":"https://api.github.com/repos/siblis/cwc-back/events","assignees_url":"https://api.github.com/repos/siblis/cwc-back/assignees{/user}","branches_url":"https://api.github.com/repos/siblis/cwc-back/branches{/branch}","tags_url":"https://api.github.com/repos/siblis/cwc-back/tags","blobs_url":"https://api.github.com/repos/siblis/cwc-back/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/siblis/cwc-back/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/siblis/cwc-back/git/refs{/sha}","trees_url":"https://api.github.com/repos/siblis/cwc-back/git/trees{/sha}","statuses_url":"https://api.github.com/repos/siblis/cwc-back/statuses/{sha}","languages_url":"https://api.github.com/repos/siblis/cwc-back/languages","stargazers_url":"https://api.github.com/repos/siblis/cwc-back/stargazers","contributors_url":"https://api.github.com/repos/siblis/cwc-back/contributors","subscribers_url":"https://api.github.com/repos/siblis/cwc-back/subscribers","subscription_url":"https://api.github.com/repos/siblis/cwc-back/subscription","commits_url":"https://api.github.com/repos/siblis/cwc-back/commits{/sha}","git_commits_url":"https://api.github.com/repos/siblis/cwc-back/git/commits{/sha}","comments_url":"https://api.github.com/repos/siblis/cwc-back/comments{/number}","issue_comment_url":"https://api.github.com/repos/siblis/cwc-back/issues/comments{/number}","contents_url":"https://api.github.com/repos/siblis/cwc-back/contents/{+path}","compare_url":"https://api.github.com/repos/siblis/cwc-back/compare/{base}...{head}","merges_url":"https://api.github.com/repos/siblis/cwc-back/merges","archive_url":"https://api.github.com/repos/siblis/cwc-back/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/siblis/cwc-back/downloads","issues_url":"https://api.github.com/repos/siblis/cwc-back/issues{/number}","pulls_url":"https://api.github.com/repos/siblis/cwc-back/pulls{/number}","milestones_url":"https://api.github.com/repos/siblis/cwc-back/milestones{/number}","notifications_url":"https://api.github.com/repos/siblis/cwc-back/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/siblis/cwc-back/labels{/name}","releases_url":"https://api.github.com/repos/siblis/cwc-back/releases{/id}","deployments_url":"https://api.github.com/repos/siblis/cwc-back/deployments","created_at":"2018-11-04T16:47:38Z","updated_at":"2018-11-05T11:09:14Z","pushed_at":"2018-11-07T18:34:46Z","git_url":"git://github.com/siblis/cwc-back.git","ssh_url":"git@github.com:siblis/cwc-back.git","clone_url":"https://github.com/siblis/cwc-back.git","svn_url":"https://github.com/siblis/cwc-back","homepage":null,"size":37,"stargazers_count":1,"watchers_count":1,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":1,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/siblis/cwc-back/pulls/5"},"html":{"href":"https://github.com/siblis/cwc-back/pull/5"},"issue":{"href":"https://api.github.com/repos/siblis/cwc-back/issues/5"},"comments":{"href":"https://api.github.com/repos/siblis/cwc-back/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/siblis/cwc-back/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/siblis/cwc-back/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/siblis/cwc-back/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/siblis/cwc-back/statuses/05ba1c93dff055b65b55c57a1ead57455dc017d6"}},"author_association":"NONE"}}
{"actor":{"display_login":"igorsimdyanov"}}