{"action":"created","comment":{"url":"https://api.github.com/repos/yochiyochirb/kajaeru/pulls/comments/54534383","id":54534383,"diff_hunk":"@@ -2,9 +2,30 @@\n # TODO FactoryGirl 使うようになったら、これぜんぶ factory にして、\n #      FactoryGirl.create(:member)\n #      みたいにインスタンスを作るコードが書いてある rake タスクを作りたいなー。\n+def reset_table(model)\n+  model.delete_all\n+  table_name = model.table_name\n+\n+  case ActiveRecord::Base.connection.adapter_name\n+  when 'SQLite'\n+    new_max = model.maximum(model.primary_key) || 0\n+    update_seq_sql = \"update sqlite_sequence set seq = #{new_max} where name = '#{table_name}';\"\n+\n+    ActiveRecord::Base.connection.execute(update_seq_sql)\n+  when 'PostgreSQL'\n+    ActiveRecord::Base.connection.reset_pk_sequence!(table_name)\n+  else\n+    raise 'Only SQLite and PostgreSQL can be reset.'\n+  end\n+end\n+\n+#truncate するのではなくdelete_allしてプライマリーキーだけ戻すようにする\n+%w(member role).map { |klass| klass.classify.constantize }\n+.each do |klass|","path":"db/seeds.rb","position":23,"original_position":23,"commit_id":"2b41d03d3ac399865dbe2515abf7b2c2a06aafc2","original_commit_id":"2b41d03d3ac399865dbe2515abf7b2c2a06aafc2","user":{"login":"ManabuSeki","id":7938885,"avatar_url":"https://avatars.githubusercontent.com/u/7938885?v=3","gravatar_id":"","url":"https://api.github.com/users/ManabuSeki","html_url":"https://github.com/ManabuSeki","followers_url":"https://api.github.com/users/ManabuSeki/followers","following_url":"https://api.github.com/users/ManabuSeki/following{/other_user}","gists_url":"https://api.github.com/users/ManabuSeki/gists{/gist_id}","starred_url":"https://api.github.com/users/ManabuSeki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ManabuSeki/subscriptions","organizations_url":"https://api.github.com/users/ManabuSeki/orgs","repos_url":"https://api.github.com/users/ManabuSeki/repos","events_url":"https://api.github.com/users/ManabuSeki/events{/privacy}","received_events_url":"https://api.github.com/users/ManabuSeki/received_events","type":"User","site_admin":false},"body":"これって\r\n```\r\n%w(member role).map { |klass| klass.classify.constantize }.each do |klass|\r\n```\r\nこうしろってことですか？","created_at":"2016-03-01T08:20:54Z","updated_at":"2016-03-01T08:20:54Z","html_url":"https://github.com/yochiyochirb/kajaeru/pull/111#discussion_r54534383","pull_request_url":"https://api.github.com/repos/yochiyochirb/kajaeru/pulls/111","_links":{"self":{"href":"https://api.github.com/repos/yochiyochirb/kajaeru/pulls/comments/54534383"},"html":{"href":"https://github.com/yochiyochirb/kajaeru/pull/111#discussion_r54534383"},"pull_request":{"href":"https://api.github.com/repos/yochiyochirb/kajaeru/pulls/111"}}},"pull_request":{"url":"https://api.github.com/repos/yochiyochirb/kajaeru/pulls/111","id":61205667,"html_url":"https://github.com/yochiyochirb/kajaeru/pull/111","diff_url":"https://github.com/yochiyochirb/kajaeru/pull/111.diff","patch_url":"https://github.com/yochiyochirb/kajaeru/pull/111.patch","issue_url":"https://api.github.com/repos/yochiyochirb/kajaeru/issues/111","number":111,"state":"open","locked":false,"title":"seedファイルに初期化用メソッドを追加した","user":{"login":"ManabuSeki","id":7938885,"avatar_url":"https://avatars.githubusercontent.com/u/7938885?v=3","gravatar_id":"","url":"https://api.github.com/users/ManabuSeki","html_url":"https://github.com/ManabuSeki","followers_url":"https://api.github.com/users/ManabuSeki/followers","following_url":"https://api.github.com/users/ManabuSeki/following{/other_user}","gists_url":"https://api.github.com/users/ManabuSeki/gists{/gist_id}","starred_url":"https://api.github.com/users/ManabuSeki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ManabuSeki/subscriptions","organizations_url":"https://api.github.com/users/ManabuSeki/orgs","repos_url":"https://api.github.com/users/ManabuSeki/repos","events_url":"https://api.github.com/users/ManabuSeki/events{/privacy}","received_events_url":"https://api.github.com/users/ManabuSeki/received_events","type":"User","site_admin":false},"body":"## やったこと\r\n - 初期化用メソッドを追加しました\r\n - delete_allを使っているところを削除しました\r\n\r\n## 対応するissue\r\nconnects to #97 ","created_at":"2016-03-01T07:56:38Z","updated_at":"2016-03-01T08:20:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"aff3cee0bf945c119c7a2cda8614073e3f89ce63","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/yochiyochirb/kajaeru/pulls/111/commits","review_comments_url":"https://api.github.com/repos/yochiyochirb/kajaeru/pulls/111/comments","review_comment_url":"https://api.github.com/repos/yochiyochirb/kajaeru/pulls/comments{/number}","comments_url":"https://api.github.com/repos/yochiyochirb/kajaeru/issues/111/comments","statuses_url":"https://api.github.com/repos/yochiyochirb/kajaeru/statuses/2b41d03d3ac399865dbe2515abf7b2c2a06aafc2","head":{"label":"yochiyochirb:modify-seed-file","ref":"modify-seed-file","sha":"2b41d03d3ac399865dbe2515abf7b2c2a06aafc2","user":{"login":"yochiyochirb","id":6112628,"avatar_url":"https://avatars.githubusercontent.com/u/6112628?v=3","gravatar_id":"","url":"https://api.github.com/users/yochiyochirb","html_url":"https://github.com/yochiyochirb","followers_url":"https://api.github.com/users/yochiyochirb/followers","following_url":"https://api.github.com/users/yochiyochirb/following{/other_user}","gists_url":"https://api.github.com/users/yochiyochirb/gists{/gist_id}","starred_url":"https://api.github.com/users/yochiyochirb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yochiyochirb/subscriptions","organizations_url":"https://api.github.com/users/yochiyochirb/orgs","repos_url":"https://api.github.com/users/yochiyochirb/repos","events_url":"https://api.github.com/users/yochiyochirb/events{/privacy}","received_events_url":"https://api.github.com/users/yochiyochirb/received_events","type":"Organization","site_admin":false},"repo":{"id":22510813,"name":"kajaeru","full_name":"yochiyochirb/kajaeru","owner":{"login":"yochiyochirb","id":6112628,"avatar_url":"https://avatars.githubusercontent.com/u/6112628?v=3","gravatar_id":"","url":"https://api.github.com/users/yochiyochirb","html_url":"https://github.com/yochiyochirb","followers_url":"https://api.github.com/users/yochiyochirb/followers","following_url":"https://api.github.com/users/yochiyochirb/following{/other_user}","gists_url":"https://api.github.com/users/yochiyochirb/gists{/gist_id}","starred_url":"https://api.github.com/users/yochiyochirb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yochiyochirb/subscriptions","organizations_url":"https://api.github.com/users/yochiyochirb/orgs","repos_url":"https://api.github.com/users/yochiyochirb/repos","events_url":"https://api.github.com/users/yochiyochirb/events{/privacy}","received_events_url":"https://api.github.com/users/yochiyochirb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yochiyochirb/kajaeru","description":"","fork":false,"url":"https://api.github.com/repos/yochiyochirb/kajaeru","forks_url":"https://api.github.com/repos/yochiyochirb/kajaeru/forks","keys_url":"https://api.github.com/repos/yochiyochirb/kajaeru/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yochiyochirb/kajaeru/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yochiyochirb/kajaeru/teams","hooks_url":"https://api.github.com/repos/yochiyochirb/kajaeru/hooks","issue_events_url":"https://api.github.com/repos/yochiyochirb/kajaeru/issues/events{/number}","events_url":"https://api.github.com/repos/yochiyochirb/kajaeru/events","assignees_url":"https://api.github.com/repos/yochiyochirb/kajaeru/assignees{/user}","branches_url":"https://api.github.com/repos/yochiyochirb/kajaeru/branches{/branch}","tags_url":"https://api.github.com/repos/yochiyochirb/kajaeru/tags","blobs_url":"https://api.github.com/repos/yochiyochirb/kajaeru/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yochiyochirb/kajaeru/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yochiyochirb/kajaeru/git/refs{/sha}","trees_url":"https://api.github.com/repos/yochiyochirb/kajaeru/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yochiyochirb/kajaeru/statuses/{sha}","languages_url":"https://api.github.com/repos/yochiyochirb/kajaeru/languages","stargazers_url":"https://api.github.com/repos/yochiyochirb/kajaeru/stargazers","contributors_url":"https://api.github.com/repos/yochiyochirb/kajaeru/contributors","subscribers_url":"https://api.github.com/repos/yochiyochirb/kajaeru/subscribers","subscription_url":"https://api.github.com/repos/yochiyochirb/kajaeru/subscription","commits_url":"https://api.github.com/repos/yochiyochirb/kajaeru/commits{/sha}","git_commits_url":"https://api.github.com/repos/yochiyochirb/kajaeru/git/commits{/sha}","comments_url":"https://api.github.com/repos/yochiyochirb/kajaeru/comments{/number}","issue_comment_url":"https://api.github.com/repos/yochiyochirb/kajaeru/issues/comments{/number}","contents_url":"https://api.github.com/repos/yochiyochirb/kajaeru/contents/{+path}","compare_url":"https://api.github.com/repos/yochiyochirb/kajaeru/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yochiyochirb/kajaeru/merges","archive_url":"https://api.github.com/repos/yochiyochirb/kajaeru/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yochiyochirb/kajaeru/downloads","issues_url":"https://api.github.com/repos/yochiyochirb/kajaeru/issues{/number}","pulls_url":"https://api.github.com/repos/yochiyochirb/kajaeru/pulls{/number}","milestones_url":"https://api.github.com/repos/yochiyochirb/kajaeru/milestones{/number}","notifications_url":"https://api.github.com/repos/yochiyochirb/kajaeru/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yochiyochirb/kajaeru/labels{/name}","releases_url":"https://api.github.com/repos/yochiyochirb/kajaeru/releases{/id}","deployments_url":"https://api.github.com/repos/yochiyochirb/kajaeru/deployments","created_at":"2014-08-01T13:29:32Z","updated_at":"2016-02-07T03:48:50Z","pushed_at":"2016-03-01T08:13:12Z","git_url":"git://github.com/yochiyochirb/kajaeru.git","ssh_url":"git@github.com:yochiyochirb/kajaeru.git","clone_url":"https://github.com/yochiyochirb/kajaeru.git","svn_url":"https://github.com/yochiyochirb/kajaeru","homepage":null,"size":244,"stargazers_count":10,"watchers_count":10,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":19,"forks":1,"open_issues":19,"watchers":10,"default_branch":"master"}},"base":{"label":"yochiyochirb:master","ref":"master","sha":"92f1a6259d524338984fca0778cda8a9ab5722c0","user":{"login":"yochiyochirb","id":6112628,"avatar_url":"https://avatars.githubusercontent.com/u/6112628?v=3","gravatar_id":"","url":"https://api.github.com/users/yochiyochirb","html_url":"https://github.com/yochiyochirb","followers_url":"https://api.github.com/users/yochiyochirb/followers","following_url":"https://api.github.com/users/yochiyochirb/following{/other_user}","gists_url":"https://api.github.com/users/yochiyochirb/gists{/gist_id}","starred_url":"https://api.github.com/users/yochiyochirb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yochiyochirb/subscriptions","organizations_url":"https://api.github.com/users/yochiyochirb/orgs","repos_url":"https://api.github.com/users/yochiyochirb/repos","events_url":"https://api.github.com/users/yochiyochirb/events{/privacy}","received_events_url":"https://api.github.com/users/yochiyochirb/received_events","type":"Organization","site_admin":false},"repo":{"id":22510813,"name":"kajaeru","full_name":"yochiyochirb/kajaeru","owner":{"login":"yochiyochirb","id":6112628,"avatar_url":"https://avatars.githubusercontent.com/u/6112628?v=3","gravatar_id":"","url":"https://api.github.com/users/yochiyochirb","html_url":"https://github.com/yochiyochirb","followers_url":"https://api.github.com/users/yochiyochirb/followers","following_url":"https://api.github.com/users/yochiyochirb/following{/other_user}","gists_url":"https://api.github.com/users/yochiyochirb/gists{/gist_id}","starred_url":"https://api.github.com/users/yochiyochirb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yochiyochirb/subscriptions","organizations_url":"https://api.github.com/users/yochiyochirb/orgs","repos_url":"https://api.github.com/users/yochiyochirb/repos","events_url":"https://api.github.com/users/yochiyochirb/events{/privacy}","received_events_url":"https://api.github.com/users/yochiyochirb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yochiyochirb/kajaeru","description":"","fork":false,"url":"https://api.github.com/repos/yochiyochirb/kajaeru","forks_url":"https://api.github.com/repos/yochiyochirb/kajaeru/forks","keys_url":"https://api.github.com/repos/yochiyochirb/kajaeru/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yochiyochirb/kajaeru/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yochiyochirb/kajaeru/teams","hooks_url":"https://api.github.com/repos/yochiyochirb/kajaeru/hooks","issue_events_url":"https://api.github.com/repos/yochiyochirb/kajaeru/issues/events{/number}","events_url":"https://api.github.com/repos/yochiyochirb/kajaeru/events","assignees_url":"https://api.github.com/repos/yochiyochirb/kajaeru/assignees{/user}","branches_url":"https://api.github.com/repos/yochiyochirb/kajaeru/branches{/branch}","tags_url":"https://api.github.com/repos/yochiyochirb/kajaeru/tags","blobs_url":"https://api.github.com/repos/yochiyochirb/kajaeru/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yochiyochirb/kajaeru/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yochiyochirb/kajaeru/git/refs{/sha}","trees_url":"https://api.github.com/repos/yochiyochirb/kajaeru/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yochiyochirb/kajaeru/statuses/{sha}","languages_url":"https://api.github.com/repos/yochiyochirb/kajaeru/languages","stargazers_url":"https://api.github.com/repos/yochiyochirb/kajaeru/stargazers","contributors_url":"https://api.github.com/repos/yochiyochirb/kajaeru/contributors","subscribers_url":"https://api.github.com/repos/yochiyochirb/kajaeru/subscribers","subscription_url":"https://api.github.com/repos/yochiyochirb/kajaeru/subscription","commits_url":"https://api.github.com/repos/yochiyochirb/kajaeru/commits{/sha}","git_commits_url":"https://api.github.com/repos/yochiyochirb/kajaeru/git/commits{/sha}","comments_url":"https://api.github.com/repos/yochiyochirb/kajaeru/comments{/number}","issue_comment_url":"https://api.github.com/repos/yochiyochirb/kajaeru/issues/comments{/number}","contents_url":"https://api.github.com/repos/yochiyochirb/kajaeru/contents/{+path}","compare_url":"https://api.github.com/repos/yochiyochirb/kajaeru/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yochiyochirb/kajaeru/merges","archive_url":"https://api.github.com/repos/yochiyochirb/kajaeru/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yochiyochirb/kajaeru/downloads","issues_url":"https://api.github.com/repos/yochiyochirb/kajaeru/issues{/number}","pulls_url":"https://api.github.com/repos/yochiyochirb/kajaeru/pulls{/number}","milestones_url":"https://api.github.com/repos/yochiyochirb/kajaeru/milestones{/number}","notifications_url":"https://api.github.com/repos/yochiyochirb/kajaeru/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yochiyochirb/kajaeru/labels{/name}","releases_url":"https://api.github.com/repos/yochiyochirb/kajaeru/releases{/id}","deployments_url":"https://api.github.com/repos/yochiyochirb/kajaeru/deployments","created_at":"2014-08-01T13:29:32Z","updated_at":"2016-02-07T03:48:50Z","pushed_at":"2016-03-01T08:13:12Z","git_url":"git://github.com/yochiyochirb/kajaeru.git","ssh_url":"git@github.com:yochiyochirb/kajaeru.git","clone_url":"https://github.com/yochiyochirb/kajaeru.git","svn_url":"https://github.com/yochiyochirb/kajaeru","homepage":null,"size":244,"stargazers_count":10,"watchers_count":10,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":19,"forks":1,"open_issues":19,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/yochiyochirb/kajaeru/pulls/111"},"html":{"href":"https://github.com/yochiyochirb/kajaeru/pull/111"},"issue":{"href":"https://api.github.com/repos/yochiyochirb/kajaeru/issues/111"},"comments":{"href":"https://api.github.com/repos/yochiyochirb/kajaeru/issues/111/comments"},"review_comments":{"href":"https://api.github.com/repos/yochiyochirb/kajaeru/pulls/111/comments"},"review_comment":{"href":"https://api.github.com/repos/yochiyochirb/kajaeru/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/yochiyochirb/kajaeru/pulls/111/commits"},"statuses":{"href":"https://api.github.com/repos/yochiyochirb/kajaeru/statuses/2b41d03d3ac399865dbe2515abf7b2c2a06aafc2"}}}}