{"action":"created","comment":{"url":"https://api.github.com/repos/ksuematsu/kws_protospace/pulls/comments/34995835","id":34995835,"diff_hunk":"@@ -0,0 +1,15 @@\n+class PrototypesController < ApplicationController\n+  def index\n+  end\n+  def new\n+    @prototype = Prototype.new\n+  end\n+  def create\n+    @prototype = Prototype.create(prototype_params)","path":"app/controllers/prototypes_controller.rb","position":8,"original_position":8,"commit_id":"25af10152510b1c2f6acaf0575fd563387f2b185","original_commit_id":"25af10152510b1c2f6acaf0575fd563387f2b185","user":{"login":"junjungoal","id":9709386,"avatar_url":"https://avatars.githubusercontent.com/u/9709386?v=3","gravatar_id":"","url":"https://api.github.com/users/junjungoal","html_url":"https://github.com/junjungoal","followers_url":"https://api.github.com/users/junjungoal/followers","following_url":"https://api.github.com/users/junjungoal/following{/other_user}","gists_url":"https://api.github.com/users/junjungoal/gists{/gist_id}","starred_url":"https://api.github.com/users/junjungoal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/junjungoal/subscriptions","organizations_url":"https://api.github.com/users/junjungoal/orgs","repos_url":"https://api.github.com/users/junjungoal/repos","events_url":"https://api.github.com/users/junjungoal/events{/privacy}","received_events_url":"https://api.github.com/users/junjungoal/received_events","type":"User","site_admin":false},"body":"prototypeを保存する際に、バリデーションをつけるべきだと思うのですが、その際に 保存に成功したらTop画面で保存することができたことを伝え、できなかった場合はnew画面にredirectしてあげる必要があるかと思います。\r\n\r\n\r\nそこでsaveメソッドが役立ちます。\r\nsaveメソッドはバリデーションに引っかからずsaveすることができたらtrueを返し、保存に失敗した場合はfalseを返してくれます。\r\n\r\nなので、以下のような形にするのがベストかと思います。\r\n\r\n```\r\n@prototype = Prototype.new\r\nif @prototype.save\r\n   成功したとこに行いたい処理\r\nelse\r\n  失敗したとこに行いたい処理\r\nend\r\n```\r\n\r\nあとはprototypeを保存することができた際に、保存できた旨を伝える方法としては flash messageを記述するのがいいかと思います。\r\n参考サイト↓\r\nhttp://ruby-rails.hatenadiary.com/entry/20141127/1417086075","created_at":"2015-07-20T13:50:14Z","updated_at":"2015-07-20T13:50:14Z","html_url":"https://github.com/ksuematsu/kws_protospace/pull/8#discussion_r34995835","pull_request_url":"https://api.github.com/repos/ksuematsu/kws_protospace/pulls/8","_links":{"self":{"href":"https://api.github.com/repos/ksuematsu/kws_protospace/pulls/comments/34995835"},"html":{"href":"https://github.com/ksuematsu/kws_protospace/pull/8#discussion_r34995835"},"pull_request":{"href":"https://api.github.com/repos/ksuematsu/kws_protospace/pulls/8"}}},"pull_request":{"url":"https://api.github.com/repos/ksuematsu/kws_protospace/pulls/8","id":40351222,"html_url":"https://github.com/ksuematsu/kws_protospace/pull/8","diff_url":"https://github.com/ksuematsu/kws_protospace/pull/8.diff","patch_url":"https://github.com/ksuematsu/kws_protospace/pull/8.patch","issue_url":"https://api.github.com/repos/ksuematsu/kws_protospace/issues/8","number":8,"state":"open","locked":false,"title":"[WIP]Implement post function of prototypes","user":{"login":"ksuematsu","id":11785735,"avatar_url":"https://avatars.githubusercontent.com/u/11785735?v=3","gravatar_id":"","url":"https://api.github.com/users/ksuematsu","html_url":"https://github.com/ksuematsu","followers_url":"https://api.github.com/users/ksuematsu/followers","following_url":"https://api.github.com/users/ksuematsu/following{/other_user}","gists_url":"https://api.github.com/users/ksuematsu/gists{/gist_id}","starred_url":"https://api.github.com/users/ksuematsu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ksuematsu/subscriptions","organizations_url":"https://api.github.com/users/ksuematsu/orgs","repos_url":"https://api.github.com/users/ksuematsu/repos","events_url":"https://api.github.com/users/ksuematsu/events{/privacy}","received_events_url":"https://api.github.com/users/ksuematsu/received_events","type":"User","site_admin":false},"body":"## ??\r\nimplement post function of prototypes(title, catch copy, concept)\r\nプロトタイプを投稿できるようにした。\r\nまず、title, catch copy, concept　の四つが保存されるようにした。\r\n\r\n## !?\r\nthis is the ctitical part of protospace\r\nこの機能がプロトスペースの一番コアな機能だから\r\n\r\n## images, tags,\r\nimages and tags will implement with later PR\r\n画像とタグに関しては後のPRで実装します","created_at":"2015-07-20T13:25:28Z","updated_at":"2015-07-20T13:50:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"13ac9b7664fd0558cf5134093d408030ae365834","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ksuematsu/kws_protospace/pulls/8/commits","review_comments_url":"https://api.github.com/repos/ksuematsu/kws_protospace/pulls/8/comments","review_comment_url":"https://api.github.com/repos/ksuematsu/kws_protospace/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ksuematsu/kws_protospace/issues/8/comments","statuses_url":"https://api.github.com/repos/ksuematsu/kws_protospace/statuses/25af10152510b1c2f6acaf0575fd563387f2b185","head":{"label":"ksuematsu:POST","ref":"POST","sha":"25af10152510b1c2f6acaf0575fd563387f2b185","user":{"login":"ksuematsu","id":11785735,"avatar_url":"https://avatars.githubusercontent.com/u/11785735?v=3","gravatar_id":"","url":"https://api.github.com/users/ksuematsu","html_url":"https://github.com/ksuematsu","followers_url":"https://api.github.com/users/ksuematsu/followers","following_url":"https://api.github.com/users/ksuematsu/following{/other_user}","gists_url":"https://api.github.com/users/ksuematsu/gists{/gist_id}","starred_url":"https://api.github.com/users/ksuematsu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ksuematsu/subscriptions","organizations_url":"https://api.github.com/users/ksuematsu/orgs","repos_url":"https://api.github.com/users/ksuematsu/repos","events_url":"https://api.github.com/users/ksuematsu/events{/privacy}","received_events_url":"https://api.github.com/users/ksuematsu/received_events","type":"User","site_admin":false},"repo":{"id":38927541,"name":"kws_protospace","full_name":"ksuematsu/kws_protospace","owner":{"login":"ksuematsu","id":11785735,"avatar_url":"https://avatars.githubusercontent.com/u/11785735?v=3","gravatar_id":"","url":"https://api.github.com/users/ksuematsu","html_url":"https://github.com/ksuematsu","followers_url":"https://api.github.com/users/ksuematsu/followers","following_url":"https://api.github.com/users/ksuematsu/following{/other_user}","gists_url":"https://api.github.com/users/ksuematsu/gists{/gist_id}","starred_url":"https://api.github.com/users/ksuematsu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ksuematsu/subscriptions","organizations_url":"https://api.github.com/users/ksuematsu/orgs","repos_url":"https://api.github.com/users/ksuematsu/repos","events_url":"https://api.github.com/users/ksuematsu/events{/privacy}","received_events_url":"https://api.github.com/users/ksuematsu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ksuematsu/kws_protospace","description":"","fork":false,"url":"https://api.github.com/repos/ksuematsu/kws_protospace","forks_url":"https://api.github.com/repos/ksuematsu/kws_protospace/forks","keys_url":"https://api.github.com/repos/ksuematsu/kws_protospace/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ksuematsu/kws_protospace/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ksuematsu/kws_protospace/teams","hooks_url":"https://api.github.com/repos/ksuematsu/kws_protospace/hooks","issue_events_url":"https://api.github.com/repos/ksuematsu/kws_protospace/issues/events{/number}","events_url":"https://api.github.com/repos/ksuematsu/kws_protospace/events","assignees_url":"https://api.github.com/repos/ksuematsu/kws_protospace/assignees{/user}","branches_url":"https://api.github.com/repos/ksuematsu/kws_protospace/branches{/branch}","tags_url":"https://api.github.com/repos/ksuematsu/kws_protospace/tags","blobs_url":"https://api.github.com/repos/ksuematsu/kws_protospace/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ksuematsu/kws_protospace/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ksuematsu/kws_protospace/git/refs{/sha}","trees_url":"https://api.github.com/repos/ksuematsu/kws_protospace/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ksuematsu/kws_protospace/statuses/{sha}","languages_url":"https://api.github.com/repos/ksuematsu/kws_protospace/languages","stargazers_url":"https://api.github.com/repos/ksuematsu/kws_protospace/stargazers","contributors_url":"https://api.github.com/repos/ksuematsu/kws_protospace/contributors","subscribers_url":"https://api.github.com/repos/ksuematsu/kws_protospace/subscribers","subscription_url":"https://api.github.com/repos/ksuematsu/kws_protospace/subscription","commits_url":"https://api.github.com/repos/ksuematsu/kws_protospace/commits{/sha}","git_commits_url":"https://api.github.com/repos/ksuematsu/kws_protospace/git/commits{/sha}","comments_url":"https://api.github.com/repos/ksuematsu/kws_protospace/comments{/number}","issue_comment_url":"https://api.github.com/repos/ksuematsu/kws_protospace/issues/comments{/number}","contents_url":"https://api.github.com/repos/ksuematsu/kws_protospace/contents/{+path}","compare_url":"https://api.github.com/repos/ksuematsu/kws_protospace/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ksuematsu/kws_protospace/merges","archive_url":"https://api.github.com/repos/ksuematsu/kws_protospace/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ksuematsu/kws_protospace/downloads","issues_url":"https://api.github.com/repos/ksuematsu/kws_protospace/issues{/number}","pulls_url":"https://api.github.com/repos/ksuematsu/kws_protospace/pulls{/number}","milestones_url":"https://api.github.com/repos/ksuematsu/kws_protospace/milestones{/number}","notifications_url":"https://api.github.com/repos/ksuematsu/kws_protospace/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ksuematsu/kws_protospace/labels{/name}","releases_url":"https://api.github.com/repos/ksuematsu/kws_protospace/releases{/id}","created_at":"2015-07-11T13:59:15Z","updated_at":"2015-07-12T08:22:53Z","pushed_at":"2015-07-20T13:39:49Z","git_url":"git://github.com/ksuematsu/kws_protospace.git","ssh_url":"git@github.com:ksuematsu/kws_protospace.git","clone_url":"https://github.com/ksuematsu/kws_protospace.git","svn_url":"https://github.com/ksuematsu/kws_protospace","homepage":null,"size":788,"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":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"ksuematsu:master","ref":"master","sha":"87b33f41bdff240a30b5593c5fbb04742962f3a4","user":{"login":"ksuematsu","id":11785735,"avatar_url":"https://avatars.githubusercontent.com/u/11785735?v=3","gravatar_id":"","url":"https://api.github.com/users/ksuematsu","html_url":"https://github.com/ksuematsu","followers_url":"https://api.github.com/users/ksuematsu/followers","following_url":"https://api.github.com/users/ksuematsu/following{/other_user}","gists_url":"https://api.github.com/users/ksuematsu/gists{/gist_id}","starred_url":"https://api.github.com/users/ksuematsu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ksuematsu/subscriptions","organizations_url":"https://api.github.com/users/ksuematsu/orgs","repos_url":"https://api.github.com/users/ksuematsu/repos","events_url":"https://api.github.com/users/ksuematsu/events{/privacy}","received_events_url":"https://api.github.com/users/ksuematsu/received_events","type":"User","site_admin":false},"repo":{"id":38927541,"name":"kws_protospace","full_name":"ksuematsu/kws_protospace","owner":{"login":"ksuematsu","id":11785735,"avatar_url":"https://avatars.githubusercontent.com/u/11785735?v=3","gravatar_id":"","url":"https://api.github.com/users/ksuematsu","html_url":"https://github.com/ksuematsu","followers_url":"https://api.github.com/users/ksuematsu/followers","following_url":"https://api.github.com/users/ksuematsu/following{/other_user}","gists_url":"https://api.github.com/users/ksuematsu/gists{/gist_id}","starred_url":"https://api.github.com/users/ksuematsu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ksuematsu/subscriptions","organizations_url":"https://api.github.com/users/ksuematsu/orgs","repos_url":"https://api.github.com/users/ksuematsu/repos","events_url":"https://api.github.com/users/ksuematsu/events{/privacy}","received_events_url":"https://api.github.com/users/ksuematsu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ksuematsu/kws_protospace","description":"","fork":false,"url":"https://api.github.com/repos/ksuematsu/kws_protospace","forks_url":"https://api.github.com/repos/ksuematsu/kws_protospace/forks","keys_url":"https://api.github.com/repos/ksuematsu/kws_protospace/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ksuematsu/kws_protospace/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ksuematsu/kws_protospace/teams","hooks_url":"https://api.github.com/repos/ksuematsu/kws_protospace/hooks","issue_events_url":"https://api.github.com/repos/ksuematsu/kws_protospace/issues/events{/number}","events_url":"https://api.github.com/repos/ksuematsu/kws_protospace/events","assignees_url":"https://api.github.com/repos/ksuematsu/kws_protospace/assignees{/user}","branches_url":"https://api.github.com/repos/ksuematsu/kws_protospace/branches{/branch}","tags_url":"https://api.github.com/repos/ksuematsu/kws_protospace/tags","blobs_url":"https://api.github.com/repos/ksuematsu/kws_protospace/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ksuematsu/kws_protospace/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ksuematsu/kws_protospace/git/refs{/sha}","trees_url":"https://api.github.com/repos/ksuematsu/kws_protospace/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ksuematsu/kws_protospace/statuses/{sha}","languages_url":"https://api.github.com/repos/ksuematsu/kws_protospace/languages","stargazers_url":"https://api.github.com/repos/ksuematsu/kws_protospace/stargazers","contributors_url":"https://api.github.com/repos/ksuematsu/kws_protospace/contributors","subscribers_url":"https://api.github.com/repos/ksuematsu/kws_protospace/subscribers","subscription_url":"https://api.github.com/repos/ksuematsu/kws_protospace/subscription","commits_url":"https://api.github.com/repos/ksuematsu/kws_protospace/commits{/sha}","git_commits_url":"https://api.github.com/repos/ksuematsu/kws_protospace/git/commits{/sha}","comments_url":"https://api.github.com/repos/ksuematsu/kws_protospace/comments{/number}","issue_comment_url":"https://api.github.com/repos/ksuematsu/kws_protospace/issues/comments{/number}","contents_url":"https://api.github.com/repos/ksuematsu/kws_protospace/contents/{+path}","compare_url":"https://api.github.com/repos/ksuematsu/kws_protospace/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ksuematsu/kws_protospace/merges","archive_url":"https://api.github.com/repos/ksuematsu/kws_protospace/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ksuematsu/kws_protospace/downloads","issues_url":"https://api.github.com/repos/ksuematsu/kws_protospace/issues{/number}","pulls_url":"https://api.github.com/repos/ksuematsu/kws_protospace/pulls{/number}","milestones_url":"https://api.github.com/repos/ksuematsu/kws_protospace/milestones{/number}","notifications_url":"https://api.github.com/repos/ksuematsu/kws_protospace/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ksuematsu/kws_protospace/labels{/name}","releases_url":"https://api.github.com/repos/ksuematsu/kws_protospace/releases{/id}","created_at":"2015-07-11T13:59:15Z","updated_at":"2015-07-12T08:22:53Z","pushed_at":"2015-07-20T13:39:49Z","git_url":"git://github.com/ksuematsu/kws_protospace.git","ssh_url":"git@github.com:ksuematsu/kws_protospace.git","clone_url":"https://github.com/ksuematsu/kws_protospace.git","svn_url":"https://github.com/ksuematsu/kws_protospace","homepage":null,"size":788,"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":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ksuematsu/kws_protospace/pulls/8"},"html":{"href":"https://github.com/ksuematsu/kws_protospace/pull/8"},"issue":{"href":"https://api.github.com/repos/ksuematsu/kws_protospace/issues/8"},"comments":{"href":"https://api.github.com/repos/ksuematsu/kws_protospace/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/ksuematsu/kws_protospace/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/ksuematsu/kws_protospace/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ksuematsu/kws_protospace/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/ksuematsu/kws_protospace/statuses/25af10152510b1c2f6acaf0575fd563387f2b185"}}}}