{"action":"created","comment":{"url":"https://api.github.com/repos/Bambina/project_x/pulls/comments/42942248","id":42942248,"diff_hunk":"@@ -0,0 +1,54 @@\n+class UsersController < ApplicationController\n+  def index\n+    @users = User.all\n+  end\n+\n+  def new\n+    @user = User.new\n+  end\n+\n+  def create\n+    @user = User.new(user_params)\n+\n+    if @user.save\n+      redirect_to @user\n+    else\n+      render 'new'\n+    end\n+  end\n+\n+  def edit\n+    @user = User.find(params[:id])","path":"app/controllers/users_controller.rb","position":21,"original_position":21,"commit_id":"8e59bac4408343f06600eb1d38f59a9338f60ca4","original_commit_id":"8e59bac4408343f06600eb1d38f59a9338f60ca4","user":{"login":"tatsuo","id":44219,"avatar_url":"https://avatars.githubusercontent.com/u/44219?v=3","gravatar_id":"","url":"https://api.github.com/users/tatsuo","html_url":"https://github.com/tatsuo","followers_url":"https://api.github.com/users/tatsuo/followers","following_url":"https://api.github.com/users/tatsuo/following{/other_user}","gists_url":"https://api.github.com/users/tatsuo/gists{/gist_id}","starred_url":"https://api.github.com/users/tatsuo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tatsuo/subscriptions","organizations_url":"https://api.github.com/users/tatsuo/orgs","repos_url":"https://api.github.com/users/tatsuo/repos","events_url":"https://api.github.com/users/tatsuo/events{/privacy}","received_events_url":"https://api.github.com/users/tatsuo/received_events","type":"User","site_admin":false},"body":"edit, show, update, destroy で同じ処理をしているので\r\n\r\n```ruby\r\n  before_action :set_user, only: %i(edit show update destroy)\r\n\r\n  def set_user\r\n    @user ||= User.find(params[:id])\r\n  end\r\n```\r\n\r\nこの様に共通化することができます〜","created_at":"2015-10-25T07:38:58Z","updated_at":"2015-10-25T07:38:58Z","html_url":"https://github.com/Bambina/project_x/pull/27#discussion_r42942248","pull_request_url":"https://api.github.com/repos/Bambina/project_x/pulls/27","_links":{"self":{"href":"https://api.github.com/repos/Bambina/project_x/pulls/comments/42942248"},"html":{"href":"https://github.com/Bambina/project_x/pull/27#discussion_r42942248"},"pull_request":{"href":"https://api.github.com/repos/Bambina/project_x/pulls/27"}}},"pull_request":{"url":"https://api.github.com/repos/Bambina/project_x/pulls/27","id":48673326,"html_url":"https://github.com/Bambina/project_x/pull/27","diff_url":"https://github.com/Bambina/project_x/pull/27.diff","patch_url":"https://github.com/Bambina/project_x/pull/27.patch","issue_url":"https://api.github.com/repos/Bambina/project_x/issues/27","number":27,"state":"open","locked":false,"title":"User registration","user":{"login":"Bambina","id":1127955,"avatar_url":"https://avatars.githubusercontent.com/u/1127955?v=3","gravatar_id":"","url":"https://api.github.com/users/Bambina","html_url":"https://github.com/Bambina","followers_url":"https://api.github.com/users/Bambina/followers","following_url":"https://api.github.com/users/Bambina/following{/other_user}","gists_url":"https://api.github.com/users/Bambina/gists{/gist_id}","starred_url":"https://api.github.com/users/Bambina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bambina/subscriptions","organizations_url":"https://api.github.com/users/Bambina/orgs","repos_url":"https://api.github.com/users/Bambina/repos","events_url":"https://api.github.com/users/Bambina/events{/privacy}","received_events_url":"https://api.github.com/users/Bambina/received_events","type":"User","site_admin":false},"body":"Userのビューとコントローラー、routesを追加しました。\r\n（CRUD操作ができるようにしました。）","created_at":"2015-10-25T07:01:28Z","updated_at":"2015-10-25T07:38:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6577d7b34028ce14020fc2f3e38f2672069f3279","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Bambina/project_x/pulls/27/commits","review_comments_url":"https://api.github.com/repos/Bambina/project_x/pulls/27/comments","review_comment_url":"https://api.github.com/repos/Bambina/project_x/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Bambina/project_x/issues/27/comments","statuses_url":"https://api.github.com/repos/Bambina/project_x/statuses/8e59bac4408343f06600eb1d38f59a9338f60ca4","head":{"label":"Bambina:user_registration","ref":"user_registration","sha":"8e59bac4408343f06600eb1d38f59a9338f60ca4","user":{"login":"Bambina","id":1127955,"avatar_url":"https://avatars.githubusercontent.com/u/1127955?v=3","gravatar_id":"","url":"https://api.github.com/users/Bambina","html_url":"https://github.com/Bambina","followers_url":"https://api.github.com/users/Bambina/followers","following_url":"https://api.github.com/users/Bambina/following{/other_user}","gists_url":"https://api.github.com/users/Bambina/gists{/gist_id}","starred_url":"https://api.github.com/users/Bambina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bambina/subscriptions","organizations_url":"https://api.github.com/users/Bambina/orgs","repos_url":"https://api.github.com/users/Bambina/repos","events_url":"https://api.github.com/users/Bambina/events{/privacy}","received_events_url":"https://api.github.com/users/Bambina/received_events","type":"User","site_admin":false},"repo":{"id":39829788,"name":"project_x","full_name":"Bambina/project_x","owner":{"login":"Bambina","id":1127955,"avatar_url":"https://avatars.githubusercontent.com/u/1127955?v=3","gravatar_id":"","url":"https://api.github.com/users/Bambina","html_url":"https://github.com/Bambina","followers_url":"https://api.github.com/users/Bambina/followers","following_url":"https://api.github.com/users/Bambina/following{/other_user}","gists_url":"https://api.github.com/users/Bambina/gists{/gist_id}","starred_url":"https://api.github.com/users/Bambina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bambina/subscriptions","organizations_url":"https://api.github.com/users/Bambina/orgs","repos_url":"https://api.github.com/users/Bambina/repos","events_url":"https://api.github.com/users/Bambina/events{/privacy}","received_events_url":"https://api.github.com/users/Bambina/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Bambina/project_x","description":"","fork":false,"url":"https://api.github.com/repos/Bambina/project_x","forks_url":"https://api.github.com/repos/Bambina/project_x/forks","keys_url":"https://api.github.com/repos/Bambina/project_x/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Bambina/project_x/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Bambina/project_x/teams","hooks_url":"https://api.github.com/repos/Bambina/project_x/hooks","issue_events_url":"https://api.github.com/repos/Bambina/project_x/issues/events{/number}","events_url":"https://api.github.com/repos/Bambina/project_x/events","assignees_url":"https://api.github.com/repos/Bambina/project_x/assignees{/user}","branches_url":"https://api.github.com/repos/Bambina/project_x/branches{/branch}","tags_url":"https://api.github.com/repos/Bambina/project_x/tags","blobs_url":"https://api.github.com/repos/Bambina/project_x/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Bambina/project_x/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Bambina/project_x/git/refs{/sha}","trees_url":"https://api.github.com/repos/Bambina/project_x/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Bambina/project_x/statuses/{sha}","languages_url":"https://api.github.com/repos/Bambina/project_x/languages","stargazers_url":"https://api.github.com/repos/Bambina/project_x/stargazers","contributors_url":"https://api.github.com/repos/Bambina/project_x/contributors","subscribers_url":"https://api.github.com/repos/Bambina/project_x/subscribers","subscription_url":"https://api.github.com/repos/Bambina/project_x/subscription","commits_url":"https://api.github.com/repos/Bambina/project_x/commits{/sha}","git_commits_url":"https://api.github.com/repos/Bambina/project_x/git/commits{/sha}","comments_url":"https://api.github.com/repos/Bambina/project_x/comments{/number}","issue_comment_url":"https://api.github.com/repos/Bambina/project_x/issues/comments{/number}","contents_url":"https://api.github.com/repos/Bambina/project_x/contents/{+path}","compare_url":"https://api.github.com/repos/Bambina/project_x/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Bambina/project_x/merges","archive_url":"https://api.github.com/repos/Bambina/project_x/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Bambina/project_x/downloads","issues_url":"https://api.github.com/repos/Bambina/project_x/issues{/number}","pulls_url":"https://api.github.com/repos/Bambina/project_x/pulls{/number}","milestones_url":"https://api.github.com/repos/Bambina/project_x/milestones{/number}","notifications_url":"https://api.github.com/repos/Bambina/project_x/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Bambina/project_x/labels{/name}","releases_url":"https://api.github.com/repos/Bambina/project_x/releases{/id}","created_at":"2015-07-28T11:19:10Z","updated_at":"2015-08-04T12:02:14Z","pushed_at":"2015-10-25T07:19:53Z","git_url":"git://github.com/Bambina/project_x.git","ssh_url":"git@github.com:Bambina/project_x.git","clone_url":"https://github.com/Bambina/project_x.git","svn_url":"https://github.com/Bambina/project_x","homepage":null,"size":464,"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":20,"forks":0,"open_issues":20,"watchers":0,"default_branch":"master"}},"base":{"label":"Bambina:master","ref":"master","sha":"6cdda63f9d1f5ab4cbd6b7910e99f09514e8ab2c","user":{"login":"Bambina","id":1127955,"avatar_url":"https://avatars.githubusercontent.com/u/1127955?v=3","gravatar_id":"","url":"https://api.github.com/users/Bambina","html_url":"https://github.com/Bambina","followers_url":"https://api.github.com/users/Bambina/followers","following_url":"https://api.github.com/users/Bambina/following{/other_user}","gists_url":"https://api.github.com/users/Bambina/gists{/gist_id}","starred_url":"https://api.github.com/users/Bambina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bambina/subscriptions","organizations_url":"https://api.github.com/users/Bambina/orgs","repos_url":"https://api.github.com/users/Bambina/repos","events_url":"https://api.github.com/users/Bambina/events{/privacy}","received_events_url":"https://api.github.com/users/Bambina/received_events","type":"User","site_admin":false},"repo":{"id":39829788,"name":"project_x","full_name":"Bambina/project_x","owner":{"login":"Bambina","id":1127955,"avatar_url":"https://avatars.githubusercontent.com/u/1127955?v=3","gravatar_id":"","url":"https://api.github.com/users/Bambina","html_url":"https://github.com/Bambina","followers_url":"https://api.github.com/users/Bambina/followers","following_url":"https://api.github.com/users/Bambina/following{/other_user}","gists_url":"https://api.github.com/users/Bambina/gists{/gist_id}","starred_url":"https://api.github.com/users/Bambina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bambina/subscriptions","organizations_url":"https://api.github.com/users/Bambina/orgs","repos_url":"https://api.github.com/users/Bambina/repos","events_url":"https://api.github.com/users/Bambina/events{/privacy}","received_events_url":"https://api.github.com/users/Bambina/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Bambina/project_x","description":"","fork":false,"url":"https://api.github.com/repos/Bambina/project_x","forks_url":"https://api.github.com/repos/Bambina/project_x/forks","keys_url":"https://api.github.com/repos/Bambina/project_x/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Bambina/project_x/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Bambina/project_x/teams","hooks_url":"https://api.github.com/repos/Bambina/project_x/hooks","issue_events_url":"https://api.github.com/repos/Bambina/project_x/issues/events{/number}","events_url":"https://api.github.com/repos/Bambina/project_x/events","assignees_url":"https://api.github.com/repos/Bambina/project_x/assignees{/user}","branches_url":"https://api.github.com/repos/Bambina/project_x/branches{/branch}","tags_url":"https://api.github.com/repos/Bambina/project_x/tags","blobs_url":"https://api.github.com/repos/Bambina/project_x/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Bambina/project_x/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Bambina/project_x/git/refs{/sha}","trees_url":"https://api.github.com/repos/Bambina/project_x/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Bambina/project_x/statuses/{sha}","languages_url":"https://api.github.com/repos/Bambina/project_x/languages","stargazers_url":"https://api.github.com/repos/Bambina/project_x/stargazers","contributors_url":"https://api.github.com/repos/Bambina/project_x/contributors","subscribers_url":"https://api.github.com/repos/Bambina/project_x/subscribers","subscription_url":"https://api.github.com/repos/Bambina/project_x/subscription","commits_url":"https://api.github.com/repos/Bambina/project_x/commits{/sha}","git_commits_url":"https://api.github.com/repos/Bambina/project_x/git/commits{/sha}","comments_url":"https://api.github.com/repos/Bambina/project_x/comments{/number}","issue_comment_url":"https://api.github.com/repos/Bambina/project_x/issues/comments{/number}","contents_url":"https://api.github.com/repos/Bambina/project_x/contents/{+path}","compare_url":"https://api.github.com/repos/Bambina/project_x/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Bambina/project_x/merges","archive_url":"https://api.github.com/repos/Bambina/project_x/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Bambina/project_x/downloads","issues_url":"https://api.github.com/repos/Bambina/project_x/issues{/number}","pulls_url":"https://api.github.com/repos/Bambina/project_x/pulls{/number}","milestones_url":"https://api.github.com/repos/Bambina/project_x/milestones{/number}","notifications_url":"https://api.github.com/repos/Bambina/project_x/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Bambina/project_x/labels{/name}","releases_url":"https://api.github.com/repos/Bambina/project_x/releases{/id}","created_at":"2015-07-28T11:19:10Z","updated_at":"2015-08-04T12:02:14Z","pushed_at":"2015-10-25T07:19:53Z","git_url":"git://github.com/Bambina/project_x.git","ssh_url":"git@github.com:Bambina/project_x.git","clone_url":"https://github.com/Bambina/project_x.git","svn_url":"https://github.com/Bambina/project_x","homepage":null,"size":464,"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":20,"forks":0,"open_issues":20,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Bambina/project_x/pulls/27"},"html":{"href":"https://github.com/Bambina/project_x/pull/27"},"issue":{"href":"https://api.github.com/repos/Bambina/project_x/issues/27"},"comments":{"href":"https://api.github.com/repos/Bambina/project_x/issues/27/comments"},"review_comments":{"href":"https://api.github.com/repos/Bambina/project_x/pulls/27/comments"},"review_comment":{"href":"https://api.github.com/repos/Bambina/project_x/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Bambina/project_x/pulls/27/commits"},"statuses":{"href":"https://api.github.com/repos/Bambina/project_x/statuses/8e59bac4408343f06600eb1d38f59a9338f60ca4"}}}}