{"action":"created","comment":{"url":"https://api.github.com/repos/ditointernet/sprintfy/pulls/comments/78646868","id":78646868,"diff_hunk":"@@ -0,0 +1,31 @@\n+class GoalsController < ApplicationController\n+  def create\n+    goal = Goal.new(params.require(:goal).permit([:description, :sprint_id]))\n+    goal.completed = false\n+\n+    unless goal.save\n+      flash[:error] = 'Não foi possível adicionar o goal'\n+    end\n+\n+    redirect_to edit_sprint_path(id: goal.sprint_id)\n+  end\n+\n+  def destroy\n+    goal_id = params.require(:goal_id)\n+\n+    goal = Goal.find(goal_id)\n+    goal.delete\n+\n+    redirect_to edit_sprint_path(id: goal.sprint_id)\n+  end\n+\n+  def mark_as_complete\n+    goal_id = params.require(:goal_id)\n+\n+    goal = Goal.find(goal_id)\n+    goal.completed = true\n+    goal.save\n+\n+    redirect_to edit_sprint_path(id: goal.sprint_id)\n+  end\n+end","path":"app/controllers/goals_controller.rb","position":31,"original_position":31,"commit_id":"6f796d0fba2612aa841e2f86bcbb84df30e167d2","original_commit_id":"6f796d0fba2612aa841e2f86bcbb84df30e167d2","user":{"login":"Diley","id":6399655,"avatar_url":"https://avatars.githubusercontent.com/u/6399655?v=3","gravatar_id":"","url":"https://api.github.com/users/Diley","html_url":"https://github.com/Diley","followers_url":"https://api.github.com/users/Diley/followers","following_url":"https://api.github.com/users/Diley/following{/other_user}","gists_url":"https://api.github.com/users/Diley/gists{/gist_id}","starred_url":"https://api.github.com/users/Diley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Diley/subscriptions","organizations_url":"https://api.github.com/users/Diley/orgs","repos_url":"https://api.github.com/users/Diley/repos","events_url":"https://api.github.com/users/Diley/events{/privacy}","received_events_url":"https://api.github.com/users/Diley/received_events","type":"User","site_admin":false},"body":"@FelipeRosa Percebi que você está usando `params.require` em mais de um lugar, o que você acha da gente extrair isso para um método? O mesmo serve para o `Goal.find(goal_id)`. Pode ser inclusive um `before_action`.","created_at":"2016-09-13T21:22:00Z","updated_at":"2016-09-13T21:22:00Z","html_url":"https://github.com/ditointernet/sprintfy/pull/18#discussion_r78646868","pull_request_url":"https://api.github.com/repos/ditointernet/sprintfy/pulls/18","_links":{"self":{"href":"https://api.github.com/repos/ditointernet/sprintfy/pulls/comments/78646868"},"html":{"href":"https://github.com/ditointernet/sprintfy/pull/18#discussion_r78646868"},"pull_request":{"href":"https://api.github.com/repos/ditointernet/sprintfy/pulls/18"}}},"pull_request":{"url":"https://api.github.com/repos/ditointernet/sprintfy/pulls/18","id":85092752,"html_url":"https://github.com/ditointernet/sprintfy/pull/18","diff_url":"https://github.com/ditointernet/sprintfy/pull/18.diff","patch_url":"https://github.com/ditointernet/sprintfy/pull/18.patch","issue_url":"https://api.github.com/repos/ditointernet/sprintfy/issues/18","number":18,"state":"open","locked":false,"title":"UI de sprints","user":{"login":"FelipeRosa","id":2042166,"avatar_url":"https://avatars.githubusercontent.com/u/2042166?v=3","gravatar_id":"","url":"https://api.github.com/users/FelipeRosa","html_url":"https://github.com/FelipeRosa","followers_url":"https://api.github.com/users/FelipeRosa/followers","following_url":"https://api.github.com/users/FelipeRosa/following{/other_user}","gists_url":"https://api.github.com/users/FelipeRosa/gists{/gist_id}","starred_url":"https://api.github.com/users/FelipeRosa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FelipeRosa/subscriptions","organizations_url":"https://api.github.com/users/FelipeRosa/orgs","repos_url":"https://api.github.com/users/FelipeRosa/repos","events_url":"https://api.github.com/users/FelipeRosa/events{/privacy}","received_events_url":"https://api.github.com/users/FelipeRosa/received_events","type":"User","site_admin":false},"body":"# Contexto\r\n\r\nAdicionar uma UI para criação de sprints.\r\n\r\n# Para testar\r\n\r\n```bash\r\ndocker-compose build\r\ndocker-compose run web rails db:migrate\r\ndocker-compose up\r\n```\r\n\r\nNo console do container, abrir o console do rails\r\n\r\n```bash\r\nrails c\r\n````\r\n\r\nCriar dois usuários\r\n\r\n```ruby\r\nUser.create(email: 'user1@email.com', password: 'senha1')\r\nUser.create(email: 'user2@email.com', password: 'senha2')\r\n```\r\n\r\nFazer login com um deles na página do app e tentar criar um sprint através da interface.","created_at":"2016-09-13T17:39:36Z","updated_at":"2016-09-13T21:22:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a4a705e97da948db30fa2541fb394bc2dc8b92a7","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ditointernet/sprintfy/pulls/18/commits","review_comments_url":"https://api.github.com/repos/ditointernet/sprintfy/pulls/18/comments","review_comment_url":"https://api.github.com/repos/ditointernet/sprintfy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ditointernet/sprintfy/issues/18/comments","statuses_url":"https://api.github.com/repos/ditointernet/sprintfy/statuses/6f796d0fba2612aa841e2f86bcbb84df30e167d2","head":{"label":"ditointernet:sprints-and-menu-ui","ref":"sprints-and-menu-ui","sha":"6f796d0fba2612aa841e2f86bcbb84df30e167d2","user":{"login":"ditointernet","id":716021,"avatar_url":"https://avatars.githubusercontent.com/u/716021?v=3","gravatar_id":"","url":"https://api.github.com/users/ditointernet","html_url":"https://github.com/ditointernet","followers_url":"https://api.github.com/users/ditointernet/followers","following_url":"https://api.github.com/users/ditointernet/following{/other_user}","gists_url":"https://api.github.com/users/ditointernet/gists{/gist_id}","starred_url":"https://api.github.com/users/ditointernet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ditointernet/subscriptions","organizations_url":"https://api.github.com/users/ditointernet/orgs","repos_url":"https://api.github.com/users/ditointernet/repos","events_url":"https://api.github.com/users/ditointernet/events{/privacy}","received_events_url":"https://api.github.com/users/ditointernet/received_events","type":"Organization","site_admin":false},"repo":{"id":67537189,"name":"sprintfy","full_name":"ditointernet/sprintfy","owner":{"login":"ditointernet","id":716021,"avatar_url":"https://avatars.githubusercontent.com/u/716021?v=3","gravatar_id":"","url":"https://api.github.com/users/ditointernet","html_url":"https://github.com/ditointernet","followers_url":"https://api.github.com/users/ditointernet/followers","following_url":"https://api.github.com/users/ditointernet/following{/other_user}","gists_url":"https://api.github.com/users/ditointernet/gists{/gist_id}","starred_url":"https://api.github.com/users/ditointernet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ditointernet/subscriptions","organizations_url":"https://api.github.com/users/ditointernet/orgs","repos_url":"https://api.github.com/users/ditointernet/repos","events_url":"https://api.github.com/users/ditointernet/events{/privacy}","received_events_url":"https://api.github.com/users/ditointernet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ditointernet/sprintfy","description":"Projeto responsável por gerir os sprint da Dito. ","fork":false,"url":"https://api.github.com/repos/ditointernet/sprintfy","forks_url":"https://api.github.com/repos/ditointernet/sprintfy/forks","keys_url":"https://api.github.com/repos/ditointernet/sprintfy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ditointernet/sprintfy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ditointernet/sprintfy/teams","hooks_url":"https://api.github.com/repos/ditointernet/sprintfy/hooks","issue_events_url":"https://api.github.com/repos/ditointernet/sprintfy/issues/events{/number}","events_url":"https://api.github.com/repos/ditointernet/sprintfy/events","assignees_url":"https://api.github.com/repos/ditointernet/sprintfy/assignees{/user}","branches_url":"https://api.github.com/repos/ditointernet/sprintfy/branches{/branch}","tags_url":"https://api.github.com/repos/ditointernet/sprintfy/tags","blobs_url":"https://api.github.com/repos/ditointernet/sprintfy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ditointernet/sprintfy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ditointernet/sprintfy/git/refs{/sha}","trees_url":"https://api.github.com/repos/ditointernet/sprintfy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ditointernet/sprintfy/statuses/{sha}","languages_url":"https://api.github.com/repos/ditointernet/sprintfy/languages","stargazers_url":"https://api.github.com/repos/ditointernet/sprintfy/stargazers","contributors_url":"https://api.github.com/repos/ditointernet/sprintfy/contributors","subscribers_url":"https://api.github.com/repos/ditointernet/sprintfy/subscribers","subscription_url":"https://api.github.com/repos/ditointernet/sprintfy/subscription","commits_url":"https://api.github.com/repos/ditointernet/sprintfy/commits{/sha}","git_commits_url":"https://api.github.com/repos/ditointernet/sprintfy/git/commits{/sha}","comments_url":"https://api.github.com/repos/ditointernet/sprintfy/comments{/number}","issue_comment_url":"https://api.github.com/repos/ditointernet/sprintfy/issues/comments{/number}","contents_url":"https://api.github.com/repos/ditointernet/sprintfy/contents/{+path}","compare_url":"https://api.github.com/repos/ditointernet/sprintfy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ditointernet/sprintfy/merges","archive_url":"https://api.github.com/repos/ditointernet/sprintfy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ditointernet/sprintfy/downloads","issues_url":"https://api.github.com/repos/ditointernet/sprintfy/issues{/number}","pulls_url":"https://api.github.com/repos/ditointernet/sprintfy/pulls{/number}","milestones_url":"https://api.github.com/repos/ditointernet/sprintfy/milestones{/number}","notifications_url":"https://api.github.com/repos/ditointernet/sprintfy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ditointernet/sprintfy/labels{/name}","releases_url":"https://api.github.com/repos/ditointernet/sprintfy/releases{/id}","deployments_url":"https://api.github.com/repos/ditointernet/sprintfy/deployments","created_at":"2016-09-06T18:49:54Z","updated_at":"2016-09-08T17:37:14Z","pushed_at":"2016-09-13T20:50:06Z","git_url":"git://github.com/ditointernet/sprintfy.git","ssh_url":"git@github.com:ditointernet/sprintfy.git","clone_url":"https://github.com/ditointernet/sprintfy.git","svn_url":"https://github.com/ditointernet/sprintfy","homepage":null,"size":78,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":0,"default_branch":"master"}},"base":{"label":"ditointernet:add-models-relationships","ref":"add-models-relationships","sha":"058c3a70b5e942c5762294ca347fd8324660c465","user":{"login":"ditointernet","id":716021,"avatar_url":"https://avatars.githubusercontent.com/u/716021?v=3","gravatar_id":"","url":"https://api.github.com/users/ditointernet","html_url":"https://github.com/ditointernet","followers_url":"https://api.github.com/users/ditointernet/followers","following_url":"https://api.github.com/users/ditointernet/following{/other_user}","gists_url":"https://api.github.com/users/ditointernet/gists{/gist_id}","starred_url":"https://api.github.com/users/ditointernet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ditointernet/subscriptions","organizations_url":"https://api.github.com/users/ditointernet/orgs","repos_url":"https://api.github.com/users/ditointernet/repos","events_url":"https://api.github.com/users/ditointernet/events{/privacy}","received_events_url":"https://api.github.com/users/ditointernet/received_events","type":"Organization","site_admin":false},"repo":{"id":67537189,"name":"sprintfy","full_name":"ditointernet/sprintfy","owner":{"login":"ditointernet","id":716021,"avatar_url":"https://avatars.githubusercontent.com/u/716021?v=3","gravatar_id":"","url":"https://api.github.com/users/ditointernet","html_url":"https://github.com/ditointernet","followers_url":"https://api.github.com/users/ditointernet/followers","following_url":"https://api.github.com/users/ditointernet/following{/other_user}","gists_url":"https://api.github.com/users/ditointernet/gists{/gist_id}","starred_url":"https://api.github.com/users/ditointernet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ditointernet/subscriptions","organizations_url":"https://api.github.com/users/ditointernet/orgs","repos_url":"https://api.github.com/users/ditointernet/repos","events_url":"https://api.github.com/users/ditointernet/events{/privacy}","received_events_url":"https://api.github.com/users/ditointernet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ditointernet/sprintfy","description":"Projeto responsável por gerir os sprint da Dito. ","fork":false,"url":"https://api.github.com/repos/ditointernet/sprintfy","forks_url":"https://api.github.com/repos/ditointernet/sprintfy/forks","keys_url":"https://api.github.com/repos/ditointernet/sprintfy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ditointernet/sprintfy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ditointernet/sprintfy/teams","hooks_url":"https://api.github.com/repos/ditointernet/sprintfy/hooks","issue_events_url":"https://api.github.com/repos/ditointernet/sprintfy/issues/events{/number}","events_url":"https://api.github.com/repos/ditointernet/sprintfy/events","assignees_url":"https://api.github.com/repos/ditointernet/sprintfy/assignees{/user}","branches_url":"https://api.github.com/repos/ditointernet/sprintfy/branches{/branch}","tags_url":"https://api.github.com/repos/ditointernet/sprintfy/tags","blobs_url":"https://api.github.com/repos/ditointernet/sprintfy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ditointernet/sprintfy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ditointernet/sprintfy/git/refs{/sha}","trees_url":"https://api.github.com/repos/ditointernet/sprintfy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ditointernet/sprintfy/statuses/{sha}","languages_url":"https://api.github.com/repos/ditointernet/sprintfy/languages","stargazers_url":"https://api.github.com/repos/ditointernet/sprintfy/stargazers","contributors_url":"https://api.github.com/repos/ditointernet/sprintfy/contributors","subscribers_url":"https://api.github.com/repos/ditointernet/sprintfy/subscribers","subscription_url":"https://api.github.com/repos/ditointernet/sprintfy/subscription","commits_url":"https://api.github.com/repos/ditointernet/sprintfy/commits{/sha}","git_commits_url":"https://api.github.com/repos/ditointernet/sprintfy/git/commits{/sha}","comments_url":"https://api.github.com/repos/ditointernet/sprintfy/comments{/number}","issue_comment_url":"https://api.github.com/repos/ditointernet/sprintfy/issues/comments{/number}","contents_url":"https://api.github.com/repos/ditointernet/sprintfy/contents/{+path}","compare_url":"https://api.github.com/repos/ditointernet/sprintfy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ditointernet/sprintfy/merges","archive_url":"https://api.github.com/repos/ditointernet/sprintfy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ditointernet/sprintfy/downloads","issues_url":"https://api.github.com/repos/ditointernet/sprintfy/issues{/number}","pulls_url":"https://api.github.com/repos/ditointernet/sprintfy/pulls{/number}","milestones_url":"https://api.github.com/repos/ditointernet/sprintfy/milestones{/number}","notifications_url":"https://api.github.com/repos/ditointernet/sprintfy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ditointernet/sprintfy/labels{/name}","releases_url":"https://api.github.com/repos/ditointernet/sprintfy/releases{/id}","deployments_url":"https://api.github.com/repos/ditointernet/sprintfy/deployments","created_at":"2016-09-06T18:49:54Z","updated_at":"2016-09-08T17:37:14Z","pushed_at":"2016-09-13T20:50:06Z","git_url":"git://github.com/ditointernet/sprintfy.git","ssh_url":"git@github.com:ditointernet/sprintfy.git","clone_url":"https://github.com/ditointernet/sprintfy.git","svn_url":"https://github.com/ditointernet/sprintfy","homepage":null,"size":78,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ditointernet/sprintfy/pulls/18"},"html":{"href":"https://github.com/ditointernet/sprintfy/pull/18"},"issue":{"href":"https://api.github.com/repos/ditointernet/sprintfy/issues/18"},"comments":{"href":"https://api.github.com/repos/ditointernet/sprintfy/issues/18/comments"},"review_comments":{"href":"https://api.github.com/repos/ditointernet/sprintfy/pulls/18/comments"},"review_comment":{"href":"https://api.github.com/repos/ditointernet/sprintfy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ditointernet/sprintfy/pulls/18/commits"},"statuses":{"href":"https://api.github.com/repos/ditointernet/sprintfy/statuses/6f796d0fba2612aa841e2f86bcbb84df30e167d2"}}}}
{"actor":{"display_login":"Diley"}}