{"action":"created","comment":{"url":"https://api.github.com/repos/testmycode/tmc-server/pulls/comments/31370324","id":31370324,"diff_hunk":"@@ -0,0 +1,46 @@\n+class TeachersController < ApplicationController\n+  before_action :set_teacher, only: [:destroy]\n+  before_action :set_organization\n+\n+  def index\n+    authorize! :teach, @organization\n+    @teachers = @organization.teachers\n+  end\n+\n+  def new\n+    authorize! :teach, @organization\n+    @teachership = Teachership.new\n+  end\n+\n+  def create\n+    authorize! :teach, @organization\n+\n+    user = User.find_by_login(teacher_params[:username])\n+    @teachership = Teachership.new(user: user, organization: @organization)\n+\n+    if @teachership.save\n+      redirect_to organization_teachers_path, notice: 'User added successfully'","path":"app/controllers/teachers_controller.rb","position":22,"original_position":22,"commit_id":"cd9b8746022a06bef91e5e798634a007c9c497cc","original_commit_id":"cd9b8746022a06bef91e5e798634a007c9c497cc","user":{"login":"jamox","id":1354151,"avatar_url":"https://avatars.githubusercontent.com/u/1354151?v=3","gravatar_id":"","url":"https://api.github.com/users/jamox","html_url":"https://github.com/jamox","followers_url":"https://api.github.com/users/jamox/followers","following_url":"https://api.github.com/users/jamox/following{/other_user}","gists_url":"https://api.github.com/users/jamox/gists{/gist_id}","starred_url":"https://api.github.com/users/jamox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamox/subscriptions","organizations_url":"https://api.github.com/users/jamox/orgs","repos_url":"https://api.github.com/users/jamox/repos","events_url":"https://api.github.com/users/jamox/events{/privacy}","received_events_url":"https://api.github.com/users/jamox/received_events","type":"User","site_admin":false},"body":"Nit: the word user might be confusing -- `User added to <>` or maybe `Teacher added to organisation`","created_at":"2015-05-29T22:28:36Z","updated_at":"2015-05-29T22:28:36Z","html_url":"https://github.com/testmycode/tmc-server/pull/256#discussion_r31370324","pull_request_url":"https://api.github.com/repos/testmycode/tmc-server/pulls/256","_links":{"self":{"href":"https://api.github.com/repos/testmycode/tmc-server/pulls/comments/31370324"},"html":{"href":"https://github.com/testmycode/tmc-server/pull/256#discussion_r31370324"},"pull_request":{"href":"https://api.github.com/repos/testmycode/tmc-server/pulls/256"}}},"pull_request":{"url":"https://api.github.com/repos/testmycode/tmc-server/pulls/256","id":35822360,"html_url":"https://github.com/testmycode/tmc-server/pull/256","diff_url":"https://github.com/testmycode/tmc-server/pull/256.diff","patch_url":"https://github.com/testmycode/tmc-server/pull/256.patch","issue_url":"https://api.github.com/repos/testmycode/tmc-server/issues/256","number":256,"state":"open","locked":false,"title":"Added course template functionality (+ organization model)","user":{"login":"FeisEater","id":5636295,"avatar_url":"https://avatars.githubusercontent.com/u/5636295?v=3","gravatar_id":"","url":"https://api.github.com/users/FeisEater","html_url":"https://github.com/FeisEater","followers_url":"https://api.github.com/users/FeisEater/followers","following_url":"https://api.github.com/users/FeisEater/following{/other_user}","gists_url":"https://api.github.com/users/FeisEater/gists{/gist_id}","starred_url":"https://api.github.com/users/FeisEater/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FeisEater/subscriptions","organizations_url":"https://api.github.com/users/FeisEater/orgs","repos_url":"https://api.github.com/users/FeisEater/repos","events_url":"https://api.github.com/users/FeisEater/events{/privacy}","received_events_url":"https://api.github.com/users/FeisEater/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-05-20T11:33:30Z","updated_at":"2015-05-29T22:28:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"219ce33f4f764d137dddadcca107f468a8c24ba2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/testmycode/tmc-server/pulls/256/commits","review_comments_url":"https://api.github.com/repos/testmycode/tmc-server/pulls/256/comments","review_comment_url":"https://api.github.com/repos/testmycode/tmc-server/pulls/comments{/number}","comments_url":"https://api.github.com/repos/testmycode/tmc-server/issues/256/comments","statuses_url":"https://api.github.com/repos/testmycode/tmc-server/statuses/cd9b8746022a06bef91e5e798634a007c9c497cc","head":{"label":"TMC-teacher-tools:master","ref":"master","sha":"cd9b8746022a06bef91e5e798634a007c9c497cc","user":{"login":"TMC-teacher-tools","id":12294621,"avatar_url":"https://avatars.githubusercontent.com/u/12294621?v=3","gravatar_id":"","url":"https://api.github.com/users/TMC-teacher-tools","html_url":"https://github.com/TMC-teacher-tools","followers_url":"https://api.github.com/users/TMC-teacher-tools/followers","following_url":"https://api.github.com/users/TMC-teacher-tools/following{/other_user}","gists_url":"https://api.github.com/users/TMC-teacher-tools/gists{/gist_id}","starred_url":"https://api.github.com/users/TMC-teacher-tools/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TMC-teacher-tools/subscriptions","organizations_url":"https://api.github.com/users/TMC-teacher-tools/orgs","repos_url":"https://api.github.com/users/TMC-teacher-tools/repos","events_url":"https://api.github.com/users/TMC-teacher-tools/events{/privacy}","received_events_url":"https://api.github.com/users/TMC-teacher-tools/received_events","type":"Organization","site_admin":false},"repo":{"id":35215878,"name":"tmc-server","full_name":"TMC-teacher-tools/tmc-server","owner":{"login":"TMC-teacher-tools","id":12294621,"avatar_url":"https://avatars.githubusercontent.com/u/12294621?v=3","gravatar_id":"","url":"https://api.github.com/users/TMC-teacher-tools","html_url":"https://github.com/TMC-teacher-tools","followers_url":"https://api.github.com/users/TMC-teacher-tools/followers","following_url":"https://api.github.com/users/TMC-teacher-tools/following{/other_user}","gists_url":"https://api.github.com/users/TMC-teacher-tools/gists{/gist_id}","starred_url":"https://api.github.com/users/TMC-teacher-tools/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TMC-teacher-tools/subscriptions","organizations_url":"https://api.github.com/users/TMC-teacher-tools/orgs","repos_url":"https://api.github.com/users/TMC-teacher-tools/repos","events_url":"https://api.github.com/users/TMC-teacher-tools/events{/privacy}","received_events_url":"https://api.github.com/users/TMC-teacher-tools/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/TMC-teacher-tools/tmc-server","description":"Test My Code server","fork":true,"url":"https://api.github.com/repos/TMC-teacher-tools/tmc-server","forks_url":"https://api.github.com/repos/TMC-teacher-tools/tmc-server/forks","keys_url":"https://api.github.com/repos/TMC-teacher-tools/tmc-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TMC-teacher-tools/tmc-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TMC-teacher-tools/tmc-server/teams","hooks_url":"https://api.github.com/repos/TMC-teacher-tools/tmc-server/hooks","issue_events_url":"https://api.github.com/repos/TMC-teacher-tools/tmc-server/issues/events{/number}","events_url":"https://api.github.com/repos/TMC-teacher-tools/tmc-server/events","assignees_url":"https://api.github.com/repos/TMC-teacher-tools/tmc-server/assignees{/user}","branches_url":"https://api.github.com/repos/TMC-teacher-tools/tmc-server/branches{/branch}","tags_url":"https://api.github.com/repos/TMC-teacher-tools/tmc-server/tags","blobs_url":"https://api.github.com/repos/TMC-teacher-tools/tmc-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TMC-teacher-tools/tmc-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TMC-teacher-tools/tmc-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/TMC-teacher-tools/tmc-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TMC-teacher-tools/tmc-server/statuses/{sha}","languages_url":"https://api.github.com/repos/TMC-teacher-tools/tmc-server/languages","stargazers_url":"https://api.github.com/repos/TMC-teacher-tools/tmc-server/stargazers","contributors_url":"https://api.github.com/repos/TMC-teacher-tools/tmc-server/contributors","subscribers_url":"https://api.github.com/repos/TMC-teacher-tools/tmc-server/subscribers","subscription_url":"https://api.github.com/repos/TMC-teacher-tools/tmc-server/subscription","commits_url":"https://api.github.com/repos/TMC-teacher-tools/tmc-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/TMC-teacher-tools/tmc-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/TMC-teacher-tools/tmc-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/TMC-teacher-tools/tmc-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/TMC-teacher-tools/tmc-server/contents/{+path}","compare_url":"https://api.github.com/repos/TMC-teacher-tools/tmc-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TMC-teacher-tools/tmc-server/merges","archive_url":"https://api.github.com/repos/TMC-teacher-tools/tmc-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TMC-teacher-tools/tmc-server/downloads","issues_url":"https://api.github.com/repos/TMC-teacher-tools/tmc-server/issues{/number}","pulls_url":"https://api.github.com/repos/TMC-teacher-tools/tmc-server/pulls{/number}","milestones_url":"https://api.github.com/repos/TMC-teacher-tools/tmc-server/milestones{/number}","notifications_url":"https://api.github.com/repos/TMC-teacher-tools/tmc-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TMC-teacher-tools/tmc-server/labels{/name}","releases_url":"https://api.github.com/repos/TMC-teacher-tools/tmc-server/releases{/id}","created_at":"2015-05-07T11:19:15Z","updated_at":"2015-05-11T08:32:55Z","pushed_at":"2015-05-29T12:52:19Z","git_url":"git://github.com/TMC-teacher-tools/tmc-server.git","ssh_url":"git@github.com:TMC-teacher-tools/tmc-server.git","clone_url":"https://github.com/TMC-teacher-tools/tmc-server.git","svn_url":"https://github.com/TMC-teacher-tools/tmc-server","homepage":"","size":7438,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":22,"forks":4,"open_issues":22,"watchers":0,"default_branch":"master"}},"base":{"label":"testmycode:tmc-teacher-tools","ref":"tmc-teacher-tools","sha":"bb71f2c36074a776042400c431e9a074124787fb","user":{"login":"testmycode","id":893468,"avatar_url":"https://avatars.githubusercontent.com/u/893468?v=3","gravatar_id":"","url":"https://api.github.com/users/testmycode","html_url":"https://github.com/testmycode","followers_url":"https://api.github.com/users/testmycode/followers","following_url":"https://api.github.com/users/testmycode/following{/other_user}","gists_url":"https://api.github.com/users/testmycode/gists{/gist_id}","starred_url":"https://api.github.com/users/testmycode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/testmycode/subscriptions","organizations_url":"https://api.github.com/users/testmycode/orgs","repos_url":"https://api.github.com/users/testmycode/repos","events_url":"https://api.github.com/users/testmycode/events{/privacy}","received_events_url":"https://api.github.com/users/testmycode/received_events","type":"Organization","site_admin":false},"repo":{"id":1995270,"name":"tmc-server","full_name":"testmycode/tmc-server","owner":{"login":"testmycode","id":893468,"avatar_url":"https://avatars.githubusercontent.com/u/893468?v=3","gravatar_id":"","url":"https://api.github.com/users/testmycode","html_url":"https://github.com/testmycode","followers_url":"https://api.github.com/users/testmycode/followers","following_url":"https://api.github.com/users/testmycode/following{/other_user}","gists_url":"https://api.github.com/users/testmycode/gists{/gist_id}","starred_url":"https://api.github.com/users/testmycode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/testmycode/subscriptions","organizations_url":"https://api.github.com/users/testmycode/orgs","repos_url":"https://api.github.com/users/testmycode/repos","events_url":"https://api.github.com/users/testmycode/events{/privacy}","received_events_url":"https://api.github.com/users/testmycode/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/testmycode/tmc-server","description":"Test My Code server","fork":false,"url":"https://api.github.com/repos/testmycode/tmc-server","forks_url":"https://api.github.com/repos/testmycode/tmc-server/forks","keys_url":"https://api.github.com/repos/testmycode/tmc-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/testmycode/tmc-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/testmycode/tmc-server/teams","hooks_url":"https://api.github.com/repos/testmycode/tmc-server/hooks","issue_events_url":"https://api.github.com/repos/testmycode/tmc-server/issues/events{/number}","events_url":"https://api.github.com/repos/testmycode/tmc-server/events","assignees_url":"https://api.github.com/repos/testmycode/tmc-server/assignees{/user}","branches_url":"https://api.github.com/repos/testmycode/tmc-server/branches{/branch}","tags_url":"https://api.github.com/repos/testmycode/tmc-server/tags","blobs_url":"https://api.github.com/repos/testmycode/tmc-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/testmycode/tmc-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/testmycode/tmc-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/testmycode/tmc-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/testmycode/tmc-server/statuses/{sha}","languages_url":"https://api.github.com/repos/testmycode/tmc-server/languages","stargazers_url":"https://api.github.com/repos/testmycode/tmc-server/stargazers","contributors_url":"https://api.github.com/repos/testmycode/tmc-server/contributors","subscribers_url":"https://api.github.com/repos/testmycode/tmc-server/subscribers","subscription_url":"https://api.github.com/repos/testmycode/tmc-server/subscription","commits_url":"https://api.github.com/repos/testmycode/tmc-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/testmycode/tmc-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/testmycode/tmc-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/testmycode/tmc-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/testmycode/tmc-server/contents/{+path}","compare_url":"https://api.github.com/repos/testmycode/tmc-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/testmycode/tmc-server/merges","archive_url":"https://api.github.com/repos/testmycode/tmc-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/testmycode/tmc-server/downloads","issues_url":"https://api.github.com/repos/testmycode/tmc-server/issues{/number}","pulls_url":"https://api.github.com/repos/testmycode/tmc-server/pulls{/number}","milestones_url":"https://api.github.com/repos/testmycode/tmc-server/milestones{/number}","notifications_url":"https://api.github.com/repos/testmycode/tmc-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/testmycode/tmc-server/labels{/name}","releases_url":"https://api.github.com/repos/testmycode/tmc-server/releases{/id}","created_at":"2011-07-04T12:29:36Z","updated_at":"2015-05-06T09:11:12Z","pushed_at":"2015-05-29T22:24:17Z","git_url":"git://github.com/testmycode/tmc-server.git","ssh_url":"git@github.com:testmycode/tmc-server.git","clone_url":"https://github.com/testmycode/tmc-server.git","svn_url":"https://github.com/testmycode/tmc-server","homepage":"","size":9066,"stargazers_count":11,"watchers_count":11,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":16,"mirror_url":null,"open_issues_count":90,"forks":16,"open_issues":90,"watchers":11,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/testmycode/tmc-server/pulls/256"},"html":{"href":"https://github.com/testmycode/tmc-server/pull/256"},"issue":{"href":"https://api.github.com/repos/testmycode/tmc-server/issues/256"},"comments":{"href":"https://api.github.com/repos/testmycode/tmc-server/issues/256/comments"},"review_comments":{"href":"https://api.github.com/repos/testmycode/tmc-server/pulls/256/comments"},"review_comment":{"href":"https://api.github.com/repos/testmycode/tmc-server/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/testmycode/tmc-server/pulls/256/commits"},"statuses":{"href":"https://api.github.com/repos/testmycode/tmc-server/statuses/cd9b8746022a06bef91e5e798634a007c9c497cc"}}}}