{"action":"created","comment":{"url":"https://api.github.com/repos/framgia/tms_45/pulls/comments/50650313","id":50650313,"diff_hunk":"@@ -1,7 +1,28 @@\n class UserCourse < ActiveRecord::Base\n-  enum status: {started: 0, finished: 1}\n-\n   belongs_to :user\n   belongs_to :course\n   has_many :user_subjects\n+\n+  before_create :set_unique_active\n+\n+  scope :has_active_user, ->(user) {where \"user_id = ? AND active = ?\", user.id, true }","path":"app/models/user_course.rb","position":10,"original_position":10,"commit_id":"de8d47cffa4ee6ece1805c4cbe9c073c29430ce7","original_commit_id":"de8d47cffa4ee6ece1805c4cbe9c073c29430ce7","user":{"login":"hellovietnam93","id":8023606,"avatar_url":"https://avatars.githubusercontent.com/u/8023606?v=3","gravatar_id":"","url":"https://api.github.com/users/hellovietnam93","html_url":"https://github.com/hellovietnam93","followers_url":"https://api.github.com/users/hellovietnam93/followers","following_url":"https://api.github.com/users/hellovietnam93/following{/other_user}","gists_url":"https://api.github.com/users/hellovietnam93/gists{/gist_id}","starred_url":"https://api.github.com/users/hellovietnam93/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hellovietnam93/subscriptions","organizations_url":"https://api.github.com/users/hellovietnam93/orgs","repos_url":"https://api.github.com/users/hellovietnam93/repos","events_url":"https://api.github.com/users/hellovietnam93/events{/privacy}","received_events_url":"https://api.github.com/users/hellovietnam93/received_events","type":"User","site_admin":false},"body":"bỏ cách ở trước }","created_at":"2016-01-25T02:44:47Z","updated_at":"2016-01-25T02:44:47Z","html_url":"https://github.com/framgia/tms_45/pull/29#discussion_r50650313","pull_request_url":"https://api.github.com/repos/framgia/tms_45/pulls/29","_links":{"self":{"href":"https://api.github.com/repos/framgia/tms_45/pulls/comments/50650313"},"html":{"href":"https://github.com/framgia/tms_45/pull/29#discussion_r50650313"},"pull_request":{"href":"https://api.github.com/repos/framgia/tms_45/pulls/29"}}},"pull_request":{"url":"https://api.github.com/repos/framgia/tms_45/pulls/29","id":57022783,"html_url":"https://github.com/framgia/tms_45/pull/29","diff_url":"https://github.com/framgia/tms_45/pull/29.diff","patch_url":"https://github.com/framgia/tms_45/pull/29.patch","issue_url":"https://api.github.com/repos/framgia/tms_45/issues/29","number":29,"state":"open","locked":false,"title":"refs #51144 Admin can add supervisor to course","user":{"login":"NeverSmileK57CLC","id":10071629,"avatar_url":"https://avatars.githubusercontent.com/u/10071629?v=3","gravatar_id":"","url":"https://api.github.com/users/NeverSmileK57CLC","html_url":"https://github.com/NeverSmileK57CLC","followers_url":"https://api.github.com/users/NeverSmileK57CLC/followers","following_url":"https://api.github.com/users/NeverSmileK57CLC/following{/other_user}","gists_url":"https://api.github.com/users/NeverSmileK57CLC/gists{/gist_id}","starred_url":"https://api.github.com/users/NeverSmileK57CLC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NeverSmileK57CLC/subscriptions","organizations_url":"https://api.github.com/users/NeverSmileK57CLC/orgs","repos_url":"https://api.github.com/users/NeverSmileK57CLC/repos","events_url":"https://api.github.com/users/NeverSmileK57CLC/events{/privacy}","received_events_url":"https://api.github.com/users/NeverSmileK57CLC/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-01-25T02:25:15Z","updated_at":"2016-01-25T02:44:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c477cd4feb75c49708df999fc52db86242033335","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/framgia/tms_45/pulls/29/commits","review_comments_url":"https://api.github.com/repos/framgia/tms_45/pulls/29/comments","review_comment_url":"https://api.github.com/repos/framgia/tms_45/pulls/comments{/number}","comments_url":"https://api.github.com/repos/framgia/tms_45/issues/29/comments","statuses_url":"https://api.github.com/repos/framgia/tms_45/statuses/de8d47cffa4ee6ece1805c4cbe9c073c29430ce7","head":{"label":"NeverSmileK57CLC:task/51144_add_supervisor_to_course","ref":"task/51144_add_supervisor_to_course","sha":"de8d47cffa4ee6ece1805c4cbe9c073c29430ce7","user":{"login":"NeverSmileK57CLC","id":10071629,"avatar_url":"https://avatars.githubusercontent.com/u/10071629?v=3","gravatar_id":"","url":"https://api.github.com/users/NeverSmileK57CLC","html_url":"https://github.com/NeverSmileK57CLC","followers_url":"https://api.github.com/users/NeverSmileK57CLC/followers","following_url":"https://api.github.com/users/NeverSmileK57CLC/following{/other_user}","gists_url":"https://api.github.com/users/NeverSmileK57CLC/gists{/gist_id}","starred_url":"https://api.github.com/users/NeverSmileK57CLC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NeverSmileK57CLC/subscriptions","organizations_url":"https://api.github.com/users/NeverSmileK57CLC/orgs","repos_url":"https://api.github.com/users/NeverSmileK57CLC/repos","events_url":"https://api.github.com/users/NeverSmileK57CLC/events{/privacy}","received_events_url":"https://api.github.com/users/NeverSmileK57CLC/received_events","type":"User","site_admin":false},"repo":{"id":49485154,"name":"tms_45","full_name":"NeverSmileK57CLC/tms_45","owner":{"login":"NeverSmileK57CLC","id":10071629,"avatar_url":"https://avatars.githubusercontent.com/u/10071629?v=3","gravatar_id":"","url":"https://api.github.com/users/NeverSmileK57CLC","html_url":"https://github.com/NeverSmileK57CLC","followers_url":"https://api.github.com/users/NeverSmileK57CLC/followers","following_url":"https://api.github.com/users/NeverSmileK57CLC/following{/other_user}","gists_url":"https://api.github.com/users/NeverSmileK57CLC/gists{/gist_id}","starred_url":"https://api.github.com/users/NeverSmileK57CLC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NeverSmileK57CLC/subscriptions","organizations_url":"https://api.github.com/users/NeverSmileK57CLC/orgs","repos_url":"https://api.github.com/users/NeverSmileK57CLC/repos","events_url":"https://api.github.com/users/NeverSmileK57CLC/events{/privacy}","received_events_url":"https://api.github.com/users/NeverSmileK57CLC/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/NeverSmileK57CLC/tms_45","description":"Framgia Training Management System (training)","fork":true,"url":"https://api.github.com/repos/NeverSmileK57CLC/tms_45","forks_url":"https://api.github.com/repos/NeverSmileK57CLC/tms_45/forks","keys_url":"https://api.github.com/repos/NeverSmileK57CLC/tms_45/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NeverSmileK57CLC/tms_45/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NeverSmileK57CLC/tms_45/teams","hooks_url":"https://api.github.com/repos/NeverSmileK57CLC/tms_45/hooks","issue_events_url":"https://api.github.com/repos/NeverSmileK57CLC/tms_45/issues/events{/number}","events_url":"https://api.github.com/repos/NeverSmileK57CLC/tms_45/events","assignees_url":"https://api.github.com/repos/NeverSmileK57CLC/tms_45/assignees{/user}","branches_url":"https://api.github.com/repos/NeverSmileK57CLC/tms_45/branches{/branch}","tags_url":"https://api.github.com/repos/NeverSmileK57CLC/tms_45/tags","blobs_url":"https://api.github.com/repos/NeverSmileK57CLC/tms_45/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NeverSmileK57CLC/tms_45/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NeverSmileK57CLC/tms_45/git/refs{/sha}","trees_url":"https://api.github.com/repos/NeverSmileK57CLC/tms_45/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NeverSmileK57CLC/tms_45/statuses/{sha}","languages_url":"https://api.github.com/repos/NeverSmileK57CLC/tms_45/languages","stargazers_url":"https://api.github.com/repos/NeverSmileK57CLC/tms_45/stargazers","contributors_url":"https://api.github.com/repos/NeverSmileK57CLC/tms_45/contributors","subscribers_url":"https://api.github.com/repos/NeverSmileK57CLC/tms_45/subscribers","subscription_url":"https://api.github.com/repos/NeverSmileK57CLC/tms_45/subscription","commits_url":"https://api.github.com/repos/NeverSmileK57CLC/tms_45/commits{/sha}","git_commits_url":"https://api.github.com/repos/NeverSmileK57CLC/tms_45/git/commits{/sha}","comments_url":"https://api.github.com/repos/NeverSmileK57CLC/tms_45/comments{/number}","issue_comment_url":"https://api.github.com/repos/NeverSmileK57CLC/tms_45/issues/comments{/number}","contents_url":"https://api.github.com/repos/NeverSmileK57CLC/tms_45/contents/{+path}","compare_url":"https://api.github.com/repos/NeverSmileK57CLC/tms_45/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NeverSmileK57CLC/tms_45/merges","archive_url":"https://api.github.com/repos/NeverSmileK57CLC/tms_45/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NeverSmileK57CLC/tms_45/downloads","issues_url":"https://api.github.com/repos/NeverSmileK57CLC/tms_45/issues{/number}","pulls_url":"https://api.github.com/repos/NeverSmileK57CLC/tms_45/pulls{/number}","milestones_url":"https://api.github.com/repos/NeverSmileK57CLC/tms_45/milestones{/number}","notifications_url":"https://api.github.com/repos/NeverSmileK57CLC/tms_45/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NeverSmileK57CLC/tms_45/labels{/name}","releases_url":"https://api.github.com/repos/NeverSmileK57CLC/tms_45/releases{/id}","deployments_url":"https://api.github.com/repos/NeverSmileK57CLC/tms_45/deployments","created_at":"2016-01-12T08:12:19Z","updated_at":"2016-01-12T02:21:47Z","pushed_at":"2016-01-25T02:43:11Z","git_url":"git://github.com/NeverSmileK57CLC/tms_45.git","ssh_url":"git@github.com:NeverSmileK57CLC/tms_45.git","clone_url":"https://github.com/NeverSmileK57CLC/tms_45.git","svn_url":"https://github.com/NeverSmileK57CLC/tms_45","homepage":null,"size":78,"stargazers_count":0,"watchers_count":0,"language":null,"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":"framgia:develop","ref":"develop","sha":"ba152b8f23b7615ae1b948da1b323179ff10f8e9","user":{"login":"framgia","id":2322183,"avatar_url":"https://avatars.githubusercontent.com/u/2322183?v=3","gravatar_id":"","url":"https://api.github.com/users/framgia","html_url":"https://github.com/framgia","followers_url":"https://api.github.com/users/framgia/followers","following_url":"https://api.github.com/users/framgia/following{/other_user}","gists_url":"https://api.github.com/users/framgia/gists{/gist_id}","starred_url":"https://api.github.com/users/framgia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/framgia/subscriptions","organizations_url":"https://api.github.com/users/framgia/orgs","repos_url":"https://api.github.com/users/framgia/repos","events_url":"https://api.github.com/users/framgia/events{/privacy}","received_events_url":"https://api.github.com/users/framgia/received_events","type":"Organization","site_admin":false},"repo":{"id":49468864,"name":"tms_45","full_name":"framgia/tms_45","owner":{"login":"framgia","id":2322183,"avatar_url":"https://avatars.githubusercontent.com/u/2322183?v=3","gravatar_id":"","url":"https://api.github.com/users/framgia","html_url":"https://github.com/framgia","followers_url":"https://api.github.com/users/framgia/followers","following_url":"https://api.github.com/users/framgia/following{/other_user}","gists_url":"https://api.github.com/users/framgia/gists{/gist_id}","starred_url":"https://api.github.com/users/framgia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/framgia/subscriptions","organizations_url":"https://api.github.com/users/framgia/orgs","repos_url":"https://api.github.com/users/framgia/repos","events_url":"https://api.github.com/users/framgia/events{/privacy}","received_events_url":"https://api.github.com/users/framgia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/framgia/tms_45","description":"Framgia Training Management System (training)","fork":false,"url":"https://api.github.com/repos/framgia/tms_45","forks_url":"https://api.github.com/repos/framgia/tms_45/forks","keys_url":"https://api.github.com/repos/framgia/tms_45/keys{/key_id}","collaborators_url":"https://api.github.com/repos/framgia/tms_45/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/framgia/tms_45/teams","hooks_url":"https://api.github.com/repos/framgia/tms_45/hooks","issue_events_url":"https://api.github.com/repos/framgia/tms_45/issues/events{/number}","events_url":"https://api.github.com/repos/framgia/tms_45/events","assignees_url":"https://api.github.com/repos/framgia/tms_45/assignees{/user}","branches_url":"https://api.github.com/repos/framgia/tms_45/branches{/branch}","tags_url":"https://api.github.com/repos/framgia/tms_45/tags","blobs_url":"https://api.github.com/repos/framgia/tms_45/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/framgia/tms_45/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/framgia/tms_45/git/refs{/sha}","trees_url":"https://api.github.com/repos/framgia/tms_45/git/trees{/sha}","statuses_url":"https://api.github.com/repos/framgia/tms_45/statuses/{sha}","languages_url":"https://api.github.com/repos/framgia/tms_45/languages","stargazers_url":"https://api.github.com/repos/framgia/tms_45/stargazers","contributors_url":"https://api.github.com/repos/framgia/tms_45/contributors","subscribers_url":"https://api.github.com/repos/framgia/tms_45/subscribers","subscription_url":"https://api.github.com/repos/framgia/tms_45/subscription","commits_url":"https://api.github.com/repos/framgia/tms_45/commits{/sha}","git_commits_url":"https://api.github.com/repos/framgia/tms_45/git/commits{/sha}","comments_url":"https://api.github.com/repos/framgia/tms_45/comments{/number}","issue_comment_url":"https://api.github.com/repos/framgia/tms_45/issues/comments{/number}","contents_url":"https://api.github.com/repos/framgia/tms_45/contents/{+path}","compare_url":"https://api.github.com/repos/framgia/tms_45/compare/{base}...{head}","merges_url":"https://api.github.com/repos/framgia/tms_45/merges","archive_url":"https://api.github.com/repos/framgia/tms_45/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/framgia/tms_45/downloads","issues_url":"https://api.github.com/repos/framgia/tms_45/issues{/number}","pulls_url":"https://api.github.com/repos/framgia/tms_45/pulls{/number}","milestones_url":"https://api.github.com/repos/framgia/tms_45/milestones{/number}","notifications_url":"https://api.github.com/repos/framgia/tms_45/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/framgia/tms_45/labels{/name}","releases_url":"https://api.github.com/repos/framgia/tms_45/releases{/id}","deployments_url":"https://api.github.com/repos/framgia/tms_45/deployments","created_at":"2016-01-12T02:21:47Z","updated_at":"2016-01-20T00:44:07Z","pushed_at":"2016-01-25T02:43:11Z","git_url":"git://github.com/framgia/tms_45.git","ssh_url":"git@github.com:framgia/tms_45.git","clone_url":"https://github.com/framgia/tms_45.git","svn_url":"https://github.com/framgia/tms_45","homepage":null,"size":89,"stargazers_count":1,"watchers_count":1,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":1,"forks":3,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/framgia/tms_45/pulls/29"},"html":{"href":"https://github.com/framgia/tms_45/pull/29"},"issue":{"href":"https://api.github.com/repos/framgia/tms_45/issues/29"},"comments":{"href":"https://api.github.com/repos/framgia/tms_45/issues/29/comments"},"review_comments":{"href":"https://api.github.com/repos/framgia/tms_45/pulls/29/comments"},"review_comment":{"href":"https://api.github.com/repos/framgia/tms_45/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/framgia/tms_45/pulls/29/commits"},"statuses":{"href":"https://api.github.com/repos/framgia/tms_45/statuses/de8d47cffa4ee6ece1805c4cbe9c073c29430ce7"}}}}