{"action":"created","comment":{"url":"https://api.github.com/repos/gitlabhq/gitlabhq/pulls/comments/23997958","id":23997958,"diff_hunk":"@@ -55,6 +55,22 @@ def find_project(id)\n       end\n     end\n \n+    def find_group(id)\n+      begin\n+        group = Group.find(id)\n+      rescue ActiveRecord::RecordNotFound\n+        group ||= Group.find_by(path: id)","path":"lib/api/helpers.rb","position":8,"original_position":8,"commit_id":"d120a91d91d2362c128e7477c4170ff0d9c94fb1","original_commit_id":"d120a91d91d2362c128e7477c4170ff0d9c94fb1","user":{"login":"jvanbaarsen","id":1362793,"avatar_url":"https://avatars.githubusercontent.com/u/1362793?v=3","gravatar_id":"","url":"https://api.github.com/users/jvanbaarsen","html_url":"https://github.com/jvanbaarsen","followers_url":"https://api.github.com/users/jvanbaarsen/followers","following_url":"https://api.github.com/users/jvanbaarsen/following{/other_user}","gists_url":"https://api.github.com/users/jvanbaarsen/gists{/gist_id}","starred_url":"https://api.github.com/users/jvanbaarsen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jvanbaarsen/subscriptions","organizations_url":"https://api.github.com/users/jvanbaarsen/orgs","repos_url":"https://api.github.com/users/jvanbaarsen/repos","events_url":"https://api.github.com/users/jvanbaarsen/events{/privacy}","received_events_url":"https://api.github.com/users/jvanbaarsen/received_events","type":"User","site_admin":false},"body":"If you make the `Group.find_by` a bang method like so: `Group.find_by!(path: id)` it will throw a `ActiveRecord::RecordNotFound`. That way you dont need the code on line 65","created_at":"2015-02-03T11:36:37Z","updated_at":"2015-02-03T11:36:37Z","html_url":"https://github.com/gitlabhq/gitlabhq/pull/8723#discussion_r23997958","pull_request_url":"https://api.github.com/repos/gitlabhq/gitlabhq/pulls/8723","_links":{"self":{"href":"https://api.github.com/repos/gitlabhq/gitlabhq/pulls/comments/23997958"},"html":{"href":"https://github.com/gitlabhq/gitlabhq/pull/8723#discussion_r23997958"},"pull_request":{"href":"https://api.github.com/repos/gitlabhq/gitlabhq/pulls/8723"}}},"pull_request":{"url":"https://api.github.com/repos/gitlabhq/gitlabhq/pulls/8723","id":28543015,"html_url":"https://github.com/gitlabhq/gitlabhq/pull/8723","diff_url":"https://github.com/gitlabhq/gitlabhq/pull/8723.diff","patch_url":"https://github.com/gitlabhq/gitlabhq/pull/8723.patch","issue_url":"https://api.github.com/repos/gitlabhq/gitlabhq/issues/8723","number":8723,"state":"open","locked":false,"title":"Access groups using path","user":{"login":"jubianchi","id":327237,"avatar_url":"https://avatars.githubusercontent.com/u/327237?v=3","gravatar_id":"","url":"https://api.github.com/users/jubianchi","html_url":"https://github.com/jubianchi","followers_url":"https://api.github.com/users/jubianchi/followers","following_url":"https://api.github.com/users/jubianchi/following{/other_user}","gists_url":"https://api.github.com/users/jubianchi/gists{/gist_id}","starred_url":"https://api.github.com/users/jubianchi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jubianchi/subscriptions","organizations_url":"https://api.github.com/users/jubianchi/orgs","repos_url":"https://api.github.com/users/jubianchi/repos","events_url":"https://api.github.com/users/jubianchi/events{/privacy}","received_events_url":"https://api.github.com/users/jubianchi/received_events","type":"User","site_admin":false},"body":"This PR allows users to access groups using their `path` in the API.","created_at":"2015-02-03T10:55:47Z","updated_at":"2015-02-03T11:36:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4539dd8a66df733d28eb3715ee644d9688b40bcb","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/gitlabhq/gitlabhq/pulls/8723/commits","review_comments_url":"https://api.github.com/repos/gitlabhq/gitlabhq/pulls/8723/comments","review_comment_url":"https://api.github.com/repos/gitlabhq/gitlabhq/pulls/comments/{number}","comments_url":"https://api.github.com/repos/gitlabhq/gitlabhq/issues/8723/comments","statuses_url":"https://api.github.com/repos/gitlabhq/gitlabhq/statuses/d120a91d91d2362c128e7477c4170ff0d9c94fb1","head":{"label":"jubianchi:api-groups-path","ref":"api-groups-path","sha":"d120a91d91d2362c128e7477c4170ff0d9c94fb1","user":{"login":"jubianchi","id":327237,"avatar_url":"https://avatars.githubusercontent.com/u/327237?v=3","gravatar_id":"","url":"https://api.github.com/users/jubianchi","html_url":"https://github.com/jubianchi","followers_url":"https://api.github.com/users/jubianchi/followers","following_url":"https://api.github.com/users/jubianchi/following{/other_user}","gists_url":"https://api.github.com/users/jubianchi/gists{/gist_id}","starred_url":"https://api.github.com/users/jubianchi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jubianchi/subscriptions","organizations_url":"https://api.github.com/users/jubianchi/orgs","repos_url":"https://api.github.com/users/jubianchi/repos","events_url":"https://api.github.com/users/jubianchi/events{/privacy}","received_events_url":"https://api.github.com/users/jubianchi/received_events","type":"User","site_admin":false},"repo":{"id":22969548,"name":"gitlabhq","full_name":"jubianchi/gitlabhq","owner":{"login":"jubianchi","id":327237,"avatar_url":"https://avatars.githubusercontent.com/u/327237?v=3","gravatar_id":"","url":"https://api.github.com/users/jubianchi","html_url":"https://github.com/jubianchi","followers_url":"https://api.github.com/users/jubianchi/followers","following_url":"https://api.github.com/users/jubianchi/following{/other_user}","gists_url":"https://api.github.com/users/jubianchi/gists{/gist_id}","starred_url":"https://api.github.com/users/jubianchi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jubianchi/subscriptions","organizations_url":"https://api.github.com/users/jubianchi/orgs","repos_url":"https://api.github.com/users/jubianchi/repos","events_url":"https://api.github.com/users/jubianchi/events{/privacy}","received_events_url":"https://api.github.com/users/jubianchi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jubianchi/gitlabhq","description":"Open source software to collaborate on code. Follow us on twitter @gitlabhq","fork":true,"url":"https://api.github.com/repos/jubianchi/gitlabhq","forks_url":"https://api.github.com/repos/jubianchi/gitlabhq/forks","keys_url":"https://api.github.com/repos/jubianchi/gitlabhq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jubianchi/gitlabhq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jubianchi/gitlabhq/teams","hooks_url":"https://api.github.com/repos/jubianchi/gitlabhq/hooks","issue_events_url":"https://api.github.com/repos/jubianchi/gitlabhq/issues/events{/number}","events_url":"https://api.github.com/repos/jubianchi/gitlabhq/events","assignees_url":"https://api.github.com/repos/jubianchi/gitlabhq/assignees{/user}","branches_url":"https://api.github.com/repos/jubianchi/gitlabhq/branches{/branch}","tags_url":"https://api.github.com/repos/jubianchi/gitlabhq/tags","blobs_url":"https://api.github.com/repos/jubianchi/gitlabhq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jubianchi/gitlabhq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jubianchi/gitlabhq/git/refs{/sha}","trees_url":"https://api.github.com/repos/jubianchi/gitlabhq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jubianchi/gitlabhq/statuses/{sha}","languages_url":"https://api.github.com/repos/jubianchi/gitlabhq/languages","stargazers_url":"https://api.github.com/repos/jubianchi/gitlabhq/stargazers","contributors_url":"https://api.github.com/repos/jubianchi/gitlabhq/contributors","subscribers_url":"https://api.github.com/repos/jubianchi/gitlabhq/subscribers","subscription_url":"https://api.github.com/repos/jubianchi/gitlabhq/subscription","commits_url":"https://api.github.com/repos/jubianchi/gitlabhq/commits{/sha}","git_commits_url":"https://api.github.com/repos/jubianchi/gitlabhq/git/commits{/sha}","comments_url":"https://api.github.com/repos/jubianchi/gitlabhq/comments{/number}","issue_comment_url":"https://api.github.com/repos/jubianchi/gitlabhq/issues/comments/{number}","contents_url":"https://api.github.com/repos/jubianchi/gitlabhq/contents/{+path}","compare_url":"https://api.github.com/repos/jubianchi/gitlabhq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jubianchi/gitlabhq/merges","archive_url":"https://api.github.com/repos/jubianchi/gitlabhq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jubianchi/gitlabhq/downloads","issues_url":"https://api.github.com/repos/jubianchi/gitlabhq/issues{/number}","pulls_url":"https://api.github.com/repos/jubianchi/gitlabhq/pulls{/number}","milestones_url":"https://api.github.com/repos/jubianchi/gitlabhq/milestones{/number}","notifications_url":"https://api.github.com/repos/jubianchi/gitlabhq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jubianchi/gitlabhq/labels{/name}","releases_url":"https://api.github.com/repos/jubianchi/gitlabhq/releases{/id}","created_at":"2014-08-14T21:40:52Z","updated_at":"2014-08-14T21:03:11Z","pushed_at":"2015-02-03T10:54:41Z","git_url":"git://github.com/jubianchi/gitlabhq.git","ssh_url":"git@github.com:jubianchi/gitlabhq.git","clone_url":"https://github.com/jubianchi/gitlabhq.git","svn_url":"https://github.com/jubianchi/gitlabhq","homepage":"https://about.gitlab.com/","size":88074,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"gitlabhq:master","ref":"master","sha":"832b63b53817cae84d8b971ce335806713ba20a1","user":{"login":"gitlabhq","id":1086321,"avatar_url":"https://avatars.githubusercontent.com/u/1086321?v=3","gravatar_id":"","url":"https://api.github.com/users/gitlabhq","html_url":"https://github.com/gitlabhq","followers_url":"https://api.github.com/users/gitlabhq/followers","following_url":"https://api.github.com/users/gitlabhq/following{/other_user}","gists_url":"https://api.github.com/users/gitlabhq/gists{/gist_id}","starred_url":"https://api.github.com/users/gitlabhq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gitlabhq/subscriptions","organizations_url":"https://api.github.com/users/gitlabhq/orgs","repos_url":"https://api.github.com/users/gitlabhq/repos","events_url":"https://api.github.com/users/gitlabhq/events{/privacy}","received_events_url":"https://api.github.com/users/gitlabhq/received_events","type":"Organization","site_admin":false},"repo":{"id":2500088,"name":"gitlabhq","full_name":"gitlabhq/gitlabhq","owner":{"login":"gitlabhq","id":1086321,"avatar_url":"https://avatars.githubusercontent.com/u/1086321?v=3","gravatar_id":"","url":"https://api.github.com/users/gitlabhq","html_url":"https://github.com/gitlabhq","followers_url":"https://api.github.com/users/gitlabhq/followers","following_url":"https://api.github.com/users/gitlabhq/following{/other_user}","gists_url":"https://api.github.com/users/gitlabhq/gists{/gist_id}","starred_url":"https://api.github.com/users/gitlabhq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gitlabhq/subscriptions","organizations_url":"https://api.github.com/users/gitlabhq/orgs","repos_url":"https://api.github.com/users/gitlabhq/repos","events_url":"https://api.github.com/users/gitlabhq/events{/privacy}","received_events_url":"https://api.github.com/users/gitlabhq/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gitlabhq/gitlabhq","description":"Open source software to collaborate on code. Follow us on twitter @gitlab","fork":false,"url":"https://api.github.com/repos/gitlabhq/gitlabhq","forks_url":"https://api.github.com/repos/gitlabhq/gitlabhq/forks","keys_url":"https://api.github.com/repos/gitlabhq/gitlabhq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gitlabhq/gitlabhq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gitlabhq/gitlabhq/teams","hooks_url":"https://api.github.com/repos/gitlabhq/gitlabhq/hooks","issue_events_url":"https://api.github.com/repos/gitlabhq/gitlabhq/issues/events{/number}","events_url":"https://api.github.com/repos/gitlabhq/gitlabhq/events","assignees_url":"https://api.github.com/repos/gitlabhq/gitlabhq/assignees{/user}","branches_url":"https://api.github.com/repos/gitlabhq/gitlabhq/branches{/branch}","tags_url":"https://api.github.com/repos/gitlabhq/gitlabhq/tags","blobs_url":"https://api.github.com/repos/gitlabhq/gitlabhq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gitlabhq/gitlabhq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gitlabhq/gitlabhq/git/refs{/sha}","trees_url":"https://api.github.com/repos/gitlabhq/gitlabhq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gitlabhq/gitlabhq/statuses/{sha}","languages_url":"https://api.github.com/repos/gitlabhq/gitlabhq/languages","stargazers_url":"https://api.github.com/repos/gitlabhq/gitlabhq/stargazers","contributors_url":"https://api.github.com/repos/gitlabhq/gitlabhq/contributors","subscribers_url":"https://api.github.com/repos/gitlabhq/gitlabhq/subscribers","subscription_url":"https://api.github.com/repos/gitlabhq/gitlabhq/subscription","commits_url":"https://api.github.com/repos/gitlabhq/gitlabhq/commits{/sha}","git_commits_url":"https://api.github.com/repos/gitlabhq/gitlabhq/git/commits{/sha}","comments_url":"https://api.github.com/repos/gitlabhq/gitlabhq/comments{/number}","issue_comment_url":"https://api.github.com/repos/gitlabhq/gitlabhq/issues/comments/{number}","contents_url":"https://api.github.com/repos/gitlabhq/gitlabhq/contents/{+path}","compare_url":"https://api.github.com/repos/gitlabhq/gitlabhq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gitlabhq/gitlabhq/merges","archive_url":"https://api.github.com/repos/gitlabhq/gitlabhq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gitlabhq/gitlabhq/downloads","issues_url":"https://api.github.com/repos/gitlabhq/gitlabhq/issues{/number}","pulls_url":"https://api.github.com/repos/gitlabhq/gitlabhq/pulls{/number}","milestones_url":"https://api.github.com/repos/gitlabhq/gitlabhq/milestones{/number}","notifications_url":"https://api.github.com/repos/gitlabhq/gitlabhq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gitlabhq/gitlabhq/labels{/name}","releases_url":"https://api.github.com/repos/gitlabhq/gitlabhq/releases{/id}","created_at":"2011-10-02T16:25:27Z","updated_at":"2015-02-03T11:18:12Z","pushed_at":"2015-02-03T11:21:22Z","git_url":"git://github.com/gitlabhq/gitlabhq.git","ssh_url":"git@github.com:gitlabhq/gitlabhq.git","clone_url":"https://github.com/gitlabhq/gitlabhq.git","svn_url":"https://github.com/gitlabhq/gitlabhq","homepage":"https://about.gitlab.com/","size":144803,"stargazers_count":14794,"watchers_count":14794,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3886,"mirror_url":null,"open_issues_count":755,"forks":3886,"open_issues":755,"watchers":14794,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gitlabhq/gitlabhq/pulls/8723"},"html":{"href":"https://github.com/gitlabhq/gitlabhq/pull/8723"},"issue":{"href":"https://api.github.com/repos/gitlabhq/gitlabhq/issues/8723"},"comments":{"href":"https://api.github.com/repos/gitlabhq/gitlabhq/issues/8723/comments"},"review_comments":{"href":"https://api.github.com/repos/gitlabhq/gitlabhq/pulls/8723/comments"},"review_comment":{"href":"https://api.github.com/repos/gitlabhq/gitlabhq/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/gitlabhq/gitlabhq/pulls/8723/commits"},"statuses":{"href":"https://api.github.com/repos/gitlabhq/gitlabhq/statuses/d120a91d91d2362c128e7477c4170ff0d9c94fb1"}}}}