{"action":"created","comment":{"url":"https://api.github.com/repos/fabiosammy/prova_web5/pulls/comments/61971201","id":61971201,"diff_hunk":"@@ -0,0 +1,76 @@\n+class People::PhonesController < ApplicationController\n+  before_action :set_person, only: [:index, :new, :create,:show, :edit, :update, :destroy]\n+\n+    def index\n+\t\t@phones = @person.phones.all\n+    end\n+\n+    def show\n+        @phone = @person.phones.find(params[:id])\n+    end\n+\n+    def new\n+\t\t@phone =  @person.phones.new\n+    end\n+\n+    def create\n+        @phone = @person.phones.new(phone_params)\n+        Phone.transaction do\n+            if (@phone.default)\n+                @person.phones.where.not(:id => @phone).update_all(:default => false)\n+            end\n+            respond_to do |format|\n+                if @phone.save\n+                    format.html { redirect_to person_phone_path(@person,@phone), notice: 'Phone was successfully created.' }\n+                    format.json { render :show, status: :created, location: @phone }\n+                else \n+                    format.html { render :new }\n+                    format.json { render json: @phone.errors, status: :unprocessable_entity }\n+                end\n+            end\n+        end\n+    end\n+\n+    def edit\n+        @phone = @person.phones.find(params[:id])\n+    end\n+\n+    def update\n+        @phone = @person.phones.find(params[:id])\n+        Phone.transaction do","path":"app/controllers/people/phones_controller.rb","position":40,"original_position":40,"commit_id":"a8836653064d17a092bc276108d782e227e25f97","original_commit_id":"a8836653064d17a092bc276108d782e227e25f97","user":{"login":"fabiosammy","id":972184,"avatar_url":"https://avatars.githubusercontent.com/u/972184?v=3","gravatar_id":"","url":"https://api.github.com/users/fabiosammy","html_url":"https://github.com/fabiosammy","followers_url":"https://api.github.com/users/fabiosammy/followers","following_url":"https://api.github.com/users/fabiosammy/following{/other_user}","gists_url":"https://api.github.com/users/fabiosammy/gists{/gist_id}","starred_url":"https://api.github.com/users/fabiosammy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fabiosammy/subscriptions","organizations_url":"https://api.github.com/users/fabiosammy/orgs","repos_url":"https://api.github.com/users/fabiosammy/repos","events_url":"https://api.github.com/users/fabiosammy/events{/privacy}","received_events_url":"https://api.github.com/users/fabiosammy/received_events","type":"User","site_admin":false},"body":"O correto seria colocar um \"validation\" no model, mas valeu o objetivo. ","created_at":"2016-05-03T23:04:13Z","updated_at":"2016-05-03T23:04:13Z","html_url":"https://github.com/fabiosammy/prova_web5/pull/5#discussion_r61971201","pull_request_url":"https://api.github.com/repos/fabiosammy/prova_web5/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/fabiosammy/prova_web5/pulls/comments/61971201"},"html":{"href":"https://github.com/fabiosammy/prova_web5/pull/5#discussion_r61971201"},"pull_request":{"href":"https://api.github.com/repos/fabiosammy/prova_web5/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/fabiosammy/prova_web5/pulls/5","id":67809780,"html_url":"https://github.com/fabiosammy/prova_web5/pull/5","diff_url":"https://github.com/fabiosammy/prova_web5/pull/5.diff","patch_url":"https://github.com/fabiosammy/prova_web5/pull/5.patch","issue_url":"https://api.github.com/repos/fabiosammy/prova_web5/issues/5","number":5,"state":"open","locked":false,"title":"WIP: Everton Leandro Baroni","user":{"login":"evertonlbaroni","id":12076618,"avatar_url":"https://avatars.githubusercontent.com/u/12076618?v=3","gravatar_id":"","url":"https://api.github.com/users/evertonlbaroni","html_url":"https://github.com/evertonlbaroni","followers_url":"https://api.github.com/users/evertonlbaroni/followers","following_url":"https://api.github.com/users/evertonlbaroni/following{/other_user}","gists_url":"https://api.github.com/users/evertonlbaroni/gists{/gist_id}","starred_url":"https://api.github.com/users/evertonlbaroni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evertonlbaroni/subscriptions","organizations_url":"https://api.github.com/users/evertonlbaroni/orgs","repos_url":"https://api.github.com/users/evertonlbaroni/repos","events_url":"https://api.github.com/users/evertonlbaroni/events{/privacy}","received_events_url":"https://api.github.com/users/evertonlbaroni/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-04-26T00:26:57Z","updated_at":"2016-05-03T23:04:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7402d0f838a1549e2905012830fc96446e7c791c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/fabiosammy/prova_web5/pulls/5/commits","review_comments_url":"https://api.github.com/repos/fabiosammy/prova_web5/pulls/5/comments","review_comment_url":"https://api.github.com/repos/fabiosammy/prova_web5/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fabiosammy/prova_web5/issues/5/comments","statuses_url":"https://api.github.com/repos/fabiosammy/prova_web5/statuses/a8836653064d17a092bc276108d782e227e25f97","head":{"label":"evertonlbaroni:master","ref":"master","sha":"a8836653064d17a092bc276108d782e227e25f97","user":{"login":"evertonlbaroni","id":12076618,"avatar_url":"https://avatars.githubusercontent.com/u/12076618?v=3","gravatar_id":"","url":"https://api.github.com/users/evertonlbaroni","html_url":"https://github.com/evertonlbaroni","followers_url":"https://api.github.com/users/evertonlbaroni/followers","following_url":"https://api.github.com/users/evertonlbaroni/following{/other_user}","gists_url":"https://api.github.com/users/evertonlbaroni/gists{/gist_id}","starred_url":"https://api.github.com/users/evertonlbaroni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evertonlbaroni/subscriptions","organizations_url":"https://api.github.com/users/evertonlbaroni/orgs","repos_url":"https://api.github.com/users/evertonlbaroni/repos","events_url":"https://api.github.com/users/evertonlbaroni/events{/privacy}","received_events_url":"https://api.github.com/users/evertonlbaroni/received_events","type":"User","site_admin":false},"repo":{"id":57083638,"name":"prova_web5","full_name":"evertonlbaroni/prova_web5","owner":{"login":"evertonlbaroni","id":12076618,"avatar_url":"https://avatars.githubusercontent.com/u/12076618?v=3","gravatar_id":"","url":"https://api.github.com/users/evertonlbaroni","html_url":"https://github.com/evertonlbaroni","followers_url":"https://api.github.com/users/evertonlbaroni/followers","following_url":"https://api.github.com/users/evertonlbaroni/following{/other_user}","gists_url":"https://api.github.com/users/evertonlbaroni/gists{/gist_id}","starred_url":"https://api.github.com/users/evertonlbaroni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evertonlbaroni/subscriptions","organizations_url":"https://api.github.com/users/evertonlbaroni/orgs","repos_url":"https://api.github.com/users/evertonlbaroni/repos","events_url":"https://api.github.com/users/evertonlbaroni/events{/privacy}","received_events_url":"https://api.github.com/users/evertonlbaroni/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/evertonlbaroni/prova_web5","description":"Prova 1 - 25/04/2016","fork":true,"url":"https://api.github.com/repos/evertonlbaroni/prova_web5","forks_url":"https://api.github.com/repos/evertonlbaroni/prova_web5/forks","keys_url":"https://api.github.com/repos/evertonlbaroni/prova_web5/keys{/key_id}","collaborators_url":"https://api.github.com/repos/evertonlbaroni/prova_web5/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/evertonlbaroni/prova_web5/teams","hooks_url":"https://api.github.com/repos/evertonlbaroni/prova_web5/hooks","issue_events_url":"https://api.github.com/repos/evertonlbaroni/prova_web5/issues/events{/number}","events_url":"https://api.github.com/repos/evertonlbaroni/prova_web5/events","assignees_url":"https://api.github.com/repos/evertonlbaroni/prova_web5/assignees{/user}","branches_url":"https://api.github.com/repos/evertonlbaroni/prova_web5/branches{/branch}","tags_url":"https://api.github.com/repos/evertonlbaroni/prova_web5/tags","blobs_url":"https://api.github.com/repos/evertonlbaroni/prova_web5/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/evertonlbaroni/prova_web5/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/evertonlbaroni/prova_web5/git/refs{/sha}","trees_url":"https://api.github.com/repos/evertonlbaroni/prova_web5/git/trees{/sha}","statuses_url":"https://api.github.com/repos/evertonlbaroni/prova_web5/statuses/{sha}","languages_url":"https://api.github.com/repos/evertonlbaroni/prova_web5/languages","stargazers_url":"https://api.github.com/repos/evertonlbaroni/prova_web5/stargazers","contributors_url":"https://api.github.com/repos/evertonlbaroni/prova_web5/contributors","subscribers_url":"https://api.github.com/repos/evertonlbaroni/prova_web5/subscribers","subscription_url":"https://api.github.com/repos/evertonlbaroni/prova_web5/subscription","commits_url":"https://api.github.com/repos/evertonlbaroni/prova_web5/commits{/sha}","git_commits_url":"https://api.github.com/repos/evertonlbaroni/prova_web5/git/commits{/sha}","comments_url":"https://api.github.com/repos/evertonlbaroni/prova_web5/comments{/number}","issue_comment_url":"https://api.github.com/repos/evertonlbaroni/prova_web5/issues/comments{/number}","contents_url":"https://api.github.com/repos/evertonlbaroni/prova_web5/contents/{+path}","compare_url":"https://api.github.com/repos/evertonlbaroni/prova_web5/compare/{base}...{head}","merges_url":"https://api.github.com/repos/evertonlbaroni/prova_web5/merges","archive_url":"https://api.github.com/repos/evertonlbaroni/prova_web5/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/evertonlbaroni/prova_web5/downloads","issues_url":"https://api.github.com/repos/evertonlbaroni/prova_web5/issues{/number}","pulls_url":"https://api.github.com/repos/evertonlbaroni/prova_web5/pulls{/number}","milestones_url":"https://api.github.com/repos/evertonlbaroni/prova_web5/milestones{/number}","notifications_url":"https://api.github.com/repos/evertonlbaroni/prova_web5/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/evertonlbaroni/prova_web5/labels{/name}","releases_url":"https://api.github.com/repos/evertonlbaroni/prova_web5/releases{/id}","deployments_url":"https://api.github.com/repos/evertonlbaroni/prova_web5/deployments","created_at":"2016-04-25T23:47:59Z","updated_at":"2016-04-25T23:48:00Z","pushed_at":"2016-05-03T22:49:13Z","git_url":"git://github.com/evertonlbaroni/prova_web5.git","ssh_url":"git@github.com:evertonlbaroni/prova_web5.git","clone_url":"https://github.com/evertonlbaroni/prova_web5.git","svn_url":"https://github.com/evertonlbaroni/prova_web5","homepage":null,"size":38,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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":"fabiosammy:master","ref":"master","sha":"bf1789ea8218bca31598f59132bc2ecb38481be6","user":{"login":"fabiosammy","id":972184,"avatar_url":"https://avatars.githubusercontent.com/u/972184?v=3","gravatar_id":"","url":"https://api.github.com/users/fabiosammy","html_url":"https://github.com/fabiosammy","followers_url":"https://api.github.com/users/fabiosammy/followers","following_url":"https://api.github.com/users/fabiosammy/following{/other_user}","gists_url":"https://api.github.com/users/fabiosammy/gists{/gist_id}","starred_url":"https://api.github.com/users/fabiosammy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fabiosammy/subscriptions","organizations_url":"https://api.github.com/users/fabiosammy/orgs","repos_url":"https://api.github.com/users/fabiosammy/repos","events_url":"https://api.github.com/users/fabiosammy/events{/privacy}","received_events_url":"https://api.github.com/users/fabiosammy/received_events","type":"User","site_admin":false},"repo":{"id":57083194,"name":"prova_web5","full_name":"fabiosammy/prova_web5","owner":{"login":"fabiosammy","id":972184,"avatar_url":"https://avatars.githubusercontent.com/u/972184?v=3","gravatar_id":"","url":"https://api.github.com/users/fabiosammy","html_url":"https://github.com/fabiosammy","followers_url":"https://api.github.com/users/fabiosammy/followers","following_url":"https://api.github.com/users/fabiosammy/following{/other_user}","gists_url":"https://api.github.com/users/fabiosammy/gists{/gist_id}","starred_url":"https://api.github.com/users/fabiosammy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fabiosammy/subscriptions","organizations_url":"https://api.github.com/users/fabiosammy/orgs","repos_url":"https://api.github.com/users/fabiosammy/repos","events_url":"https://api.github.com/users/fabiosammy/events{/privacy}","received_events_url":"https://api.github.com/users/fabiosammy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fabiosammy/prova_web5","description":"Prova 1 - 25/04/2016","fork":false,"url":"https://api.github.com/repos/fabiosammy/prova_web5","forks_url":"https://api.github.com/repos/fabiosammy/prova_web5/forks","keys_url":"https://api.github.com/repos/fabiosammy/prova_web5/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fabiosammy/prova_web5/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fabiosammy/prova_web5/teams","hooks_url":"https://api.github.com/repos/fabiosammy/prova_web5/hooks","issue_events_url":"https://api.github.com/repos/fabiosammy/prova_web5/issues/events{/number}","events_url":"https://api.github.com/repos/fabiosammy/prova_web5/events","assignees_url":"https://api.github.com/repos/fabiosammy/prova_web5/assignees{/user}","branches_url":"https://api.github.com/repos/fabiosammy/prova_web5/branches{/branch}","tags_url":"https://api.github.com/repos/fabiosammy/prova_web5/tags","blobs_url":"https://api.github.com/repos/fabiosammy/prova_web5/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fabiosammy/prova_web5/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fabiosammy/prova_web5/git/refs{/sha}","trees_url":"https://api.github.com/repos/fabiosammy/prova_web5/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fabiosammy/prova_web5/statuses/{sha}","languages_url":"https://api.github.com/repos/fabiosammy/prova_web5/languages","stargazers_url":"https://api.github.com/repos/fabiosammy/prova_web5/stargazers","contributors_url":"https://api.github.com/repos/fabiosammy/prova_web5/contributors","subscribers_url":"https://api.github.com/repos/fabiosammy/prova_web5/subscribers","subscription_url":"https://api.github.com/repos/fabiosammy/prova_web5/subscription","commits_url":"https://api.github.com/repos/fabiosammy/prova_web5/commits{/sha}","git_commits_url":"https://api.github.com/repos/fabiosammy/prova_web5/git/commits{/sha}","comments_url":"https://api.github.com/repos/fabiosammy/prova_web5/comments{/number}","issue_comment_url":"https://api.github.com/repos/fabiosammy/prova_web5/issues/comments{/number}","contents_url":"https://api.github.com/repos/fabiosammy/prova_web5/contents/{+path}","compare_url":"https://api.github.com/repos/fabiosammy/prova_web5/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fabiosammy/prova_web5/merges","archive_url":"https://api.github.com/repos/fabiosammy/prova_web5/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fabiosammy/prova_web5/downloads","issues_url":"https://api.github.com/repos/fabiosammy/prova_web5/issues{/number}","pulls_url":"https://api.github.com/repos/fabiosammy/prova_web5/pulls{/number}","milestones_url":"https://api.github.com/repos/fabiosammy/prova_web5/milestones{/number}","notifications_url":"https://api.github.com/repos/fabiosammy/prova_web5/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fabiosammy/prova_web5/labels{/name}","releases_url":"https://api.github.com/repos/fabiosammy/prova_web5/releases{/id}","deployments_url":"https://api.github.com/repos/fabiosammy/prova_web5/deployments","created_at":"2016-04-25T23:36:07Z","updated_at":"2016-04-25T23:39:48Z","pushed_at":"2016-05-03T22:49:13Z","git_url":"git://github.com/fabiosammy/prova_web5.git","ssh_url":"git@github.com:fabiosammy/prova_web5.git","clone_url":"https://github.com/fabiosammy/prova_web5.git","svn_url":"https://github.com/fabiosammy/prova_web5","homepage":null,"size":17,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":6,"forks":6,"open_issues":6,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fabiosammy/prova_web5/pulls/5"},"html":{"href":"https://github.com/fabiosammy/prova_web5/pull/5"},"issue":{"href":"https://api.github.com/repos/fabiosammy/prova_web5/issues/5"},"comments":{"href":"https://api.github.com/repos/fabiosammy/prova_web5/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/fabiosammy/prova_web5/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/fabiosammy/prova_web5/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fabiosammy/prova_web5/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/fabiosammy/prova_web5/statuses/a8836653064d17a092bc276108d782e227e25f97"}}}}