{"action":"created","comment":{"url":"https://api.github.com/repos/framgia/fels_146/pulls/comments/68877843","id":68877843,"diff_hunk":"@@ -2,4 +2,22 @@ class Lesson < ActiveRecord::Base\n   has_many :lesson_words, dependent: :destroy\n   belongs_to :category\n   belongs_to :user\n+\n+  before_save :assign_words\n+\n+  validates :category, presence: true\n+  validate :check_words_category\n+\n+  private\n+  def assign_words\n+    Word.prepare_lesson(self).each do |word|\n+      self.lesson_words.build word_id: word.id","path":"app/models/lesson.rb","position":13,"original_position":13,"commit_id":"8025abdd4921753d4821d23c1ec909bf314b1b14","original_commit_id":"8025abdd4921753d4821d23c1ec909bf314b1b14","user":{"login":"nguyenluc312","id":19769129,"avatar_url":"https://avatars.githubusercontent.com/u/19769129?v=3","gravatar_id":"","url":"https://api.github.com/users/nguyenluc312","html_url":"https://github.com/nguyenluc312","followers_url":"https://api.github.com/users/nguyenluc312/followers","following_url":"https://api.github.com/users/nguyenluc312/following{/other_user}","gists_url":"https://api.github.com/users/nguyenluc312/gists{/gist_id}","starred_url":"https://api.github.com/users/nguyenluc312/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nguyenluc312/subscriptions","organizations_url":"https://api.github.com/users/nguyenluc312/orgs","repos_url":"https://api.github.com/users/nguyenluc312/repos","events_url":"https://api.github.com/users/nguyenluc312/events{/privacy}","received_events_url":"https://api.github.com/users/nguyenluc312/received_events","type":"User","site_admin":false},"body":"em chưa tìm hiểu nhiều về phần này nên tạm thời chỉ nghĩ ra cách này thôi ạ","created_at":"2016-06-29T02:47:02Z","updated_at":"2016-06-29T02:47:02Z","html_url":"https://github.com/framgia/fels_146/pull/26#discussion_r68877843","pull_request_url":"https://api.github.com/repos/framgia/fels_146/pulls/26","_links":{"self":{"href":"https://api.github.com/repos/framgia/fels_146/pulls/comments/68877843"},"html":{"href":"https://github.com/framgia/fels_146/pull/26#discussion_r68877843"},"pull_request":{"href":"https://api.github.com/repos/framgia/fels_146/pulls/26"}}},"pull_request":{"url":"https://api.github.com/repos/framgia/fels_146/pulls/26","id":75414472,"html_url":"https://github.com/framgia/fels_146/pull/26","diff_url":"https://github.com/framgia/fels_146/pull/26.diff","patch_url":"https://github.com/framgia/fels_146/pull/26.patch","issue_url":"https://api.github.com/repos/framgia/fels_146/issues/26","number":26,"state":"open","locked":false,"title":"Create lesson","user":{"login":"nguyenluc312","id":19769129,"avatar_url":"https://avatars.githubusercontent.com/u/19769129?v=3","gravatar_id":"","url":"https://api.github.com/users/nguyenluc312","html_url":"https://github.com/nguyenluc312","followers_url":"https://api.github.com/users/nguyenluc312/followers","following_url":"https://api.github.com/users/nguyenluc312/following{/other_user}","gists_url":"https://api.github.com/users/nguyenluc312/gists{/gist_id}","starred_url":"https://api.github.com/users/nguyenluc312/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nguyenluc312/subscriptions","organizations_url":"https://api.github.com/users/nguyenluc312/orgs","repos_url":"https://api.github.com/users/nguyenluc312/repos","events_url":"https://api.github.com/users/nguyenluc312/events{/privacy}","received_events_url":"https://api.github.com/users/nguyenluc312/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-06-28T03:47:53Z","updated_at":"2016-06-29T02:47:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"705d434c6fbadb1c7392a77d6bcfdb878d018208","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/framgia/fels_146/pulls/26/commits","review_comments_url":"https://api.github.com/repos/framgia/fels_146/pulls/26/comments","review_comment_url":"https://api.github.com/repos/framgia/fels_146/pulls/comments{/number}","comments_url":"https://api.github.com/repos/framgia/fels_146/issues/26/comments","statuses_url":"https://api.github.com/repos/framgia/fels_146/statuses/8025abdd4921753d4821d23c1ec909bf314b1b14","head":{"label":"nguyenluc312:create-lesson","ref":"create-lesson","sha":"8025abdd4921753d4821d23c1ec909bf314b1b14","user":{"login":"nguyenluc312","id":19769129,"avatar_url":"https://avatars.githubusercontent.com/u/19769129?v=3","gravatar_id":"","url":"https://api.github.com/users/nguyenluc312","html_url":"https://github.com/nguyenluc312","followers_url":"https://api.github.com/users/nguyenluc312/followers","following_url":"https://api.github.com/users/nguyenluc312/following{/other_user}","gists_url":"https://api.github.com/users/nguyenluc312/gists{/gist_id}","starred_url":"https://api.github.com/users/nguyenluc312/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nguyenluc312/subscriptions","organizations_url":"https://api.github.com/users/nguyenluc312/orgs","repos_url":"https://api.github.com/users/nguyenluc312/repos","events_url":"https://api.github.com/users/nguyenluc312/events{/privacy}","received_events_url":"https://api.github.com/users/nguyenluc312/received_events","type":"User","site_admin":false},"repo":{"id":61564437,"name":"fels_146","full_name":"nguyenluc312/fels_146","owner":{"login":"nguyenluc312","id":19769129,"avatar_url":"https://avatars.githubusercontent.com/u/19769129?v=3","gravatar_id":"","url":"https://api.github.com/users/nguyenluc312","html_url":"https://github.com/nguyenluc312","followers_url":"https://api.github.com/users/nguyenluc312/followers","following_url":"https://api.github.com/users/nguyenluc312/following{/other_user}","gists_url":"https://api.github.com/users/nguyenluc312/gists{/gist_id}","starred_url":"https://api.github.com/users/nguyenluc312/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nguyenluc312/subscriptions","organizations_url":"https://api.github.com/users/nguyenluc312/orgs","repos_url":"https://api.github.com/users/nguyenluc312/repos","events_url":"https://api.github.com/users/nguyenluc312/events{/privacy}","received_events_url":"https://api.github.com/users/nguyenluc312/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nguyenluc312/fels_146","description":"Framgia E-Learning System (training)","fork":true,"url":"https://api.github.com/repos/nguyenluc312/fels_146","forks_url":"https://api.github.com/repos/nguyenluc312/fels_146/forks","keys_url":"https://api.github.com/repos/nguyenluc312/fels_146/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nguyenluc312/fels_146/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nguyenluc312/fels_146/teams","hooks_url":"https://api.github.com/repos/nguyenluc312/fels_146/hooks","issue_events_url":"https://api.github.com/repos/nguyenluc312/fels_146/issues/events{/number}","events_url":"https://api.github.com/repos/nguyenluc312/fels_146/events","assignees_url":"https://api.github.com/repos/nguyenluc312/fels_146/assignees{/user}","branches_url":"https://api.github.com/repos/nguyenluc312/fels_146/branches{/branch}","tags_url":"https://api.github.com/repos/nguyenluc312/fels_146/tags","blobs_url":"https://api.github.com/repos/nguyenluc312/fels_146/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nguyenluc312/fels_146/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nguyenluc312/fels_146/git/refs{/sha}","trees_url":"https://api.github.com/repos/nguyenluc312/fels_146/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nguyenluc312/fels_146/statuses/{sha}","languages_url":"https://api.github.com/repos/nguyenluc312/fels_146/languages","stargazers_url":"https://api.github.com/repos/nguyenluc312/fels_146/stargazers","contributors_url":"https://api.github.com/repos/nguyenluc312/fels_146/contributors","subscribers_url":"https://api.github.com/repos/nguyenluc312/fels_146/subscribers","subscription_url":"https://api.github.com/repos/nguyenluc312/fels_146/subscription","commits_url":"https://api.github.com/repos/nguyenluc312/fels_146/commits{/sha}","git_commits_url":"https://api.github.com/repos/nguyenluc312/fels_146/git/commits{/sha}","comments_url":"https://api.github.com/repos/nguyenluc312/fels_146/comments{/number}","issue_comment_url":"https://api.github.com/repos/nguyenluc312/fels_146/issues/comments{/number}","contents_url":"https://api.github.com/repos/nguyenluc312/fels_146/contents/{+path}","compare_url":"https://api.github.com/repos/nguyenluc312/fels_146/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nguyenluc312/fels_146/merges","archive_url":"https://api.github.com/repos/nguyenluc312/fels_146/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nguyenluc312/fels_146/downloads","issues_url":"https://api.github.com/repos/nguyenluc312/fels_146/issues{/number}","pulls_url":"https://api.github.com/repos/nguyenluc312/fels_146/pulls{/number}","milestones_url":"https://api.github.com/repos/nguyenluc312/fels_146/milestones{/number}","notifications_url":"https://api.github.com/repos/nguyenluc312/fels_146/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nguyenluc312/fels_146/labels{/name}","releases_url":"https://api.github.com/repos/nguyenluc312/fels_146/releases{/id}","deployments_url":"https://api.github.com/repos/nguyenluc312/fels_146/deployments","created_at":"2016-06-20T16:50:22Z","updated_at":"2016-06-20T05:54:01Z","pushed_at":"2016-06-29T02:37:07Z","git_url":"git://github.com/nguyenluc312/fels_146.git","ssh_url":"git@github.com:nguyenluc312/fels_146.git","clone_url":"https://github.com/nguyenluc312/fels_146.git","svn_url":"https://github.com/nguyenluc312/fels_146","homepage":null,"size":86,"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":"d05d5d2a93f4e2aa55368ffa349218bf470660c2","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":61520364,"name":"fels_146","full_name":"framgia/fels_146","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/fels_146","description":"Framgia E-Learning System (training)","fork":false,"url":"https://api.github.com/repos/framgia/fels_146","forks_url":"https://api.github.com/repos/framgia/fels_146/forks","keys_url":"https://api.github.com/repos/framgia/fels_146/keys{/key_id}","collaborators_url":"https://api.github.com/repos/framgia/fels_146/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/framgia/fels_146/teams","hooks_url":"https://api.github.com/repos/framgia/fels_146/hooks","issue_events_url":"https://api.github.com/repos/framgia/fels_146/issues/events{/number}","events_url":"https://api.github.com/repos/framgia/fels_146/events","assignees_url":"https://api.github.com/repos/framgia/fels_146/assignees{/user}","branches_url":"https://api.github.com/repos/framgia/fels_146/branches{/branch}","tags_url":"https://api.github.com/repos/framgia/fels_146/tags","blobs_url":"https://api.github.com/repos/framgia/fels_146/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/framgia/fels_146/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/framgia/fels_146/git/refs{/sha}","trees_url":"https://api.github.com/repos/framgia/fels_146/git/trees{/sha}","statuses_url":"https://api.github.com/repos/framgia/fels_146/statuses/{sha}","languages_url":"https://api.github.com/repos/framgia/fels_146/languages","stargazers_url":"https://api.github.com/repos/framgia/fels_146/stargazers","contributors_url":"https://api.github.com/repos/framgia/fels_146/contributors","subscribers_url":"https://api.github.com/repos/framgia/fels_146/subscribers","subscription_url":"https://api.github.com/repos/framgia/fels_146/subscription","commits_url":"https://api.github.com/repos/framgia/fels_146/commits{/sha}","git_commits_url":"https://api.github.com/repos/framgia/fels_146/git/commits{/sha}","comments_url":"https://api.github.com/repos/framgia/fels_146/comments{/number}","issue_comment_url":"https://api.github.com/repos/framgia/fels_146/issues/comments{/number}","contents_url":"https://api.github.com/repos/framgia/fels_146/contents/{+path}","compare_url":"https://api.github.com/repos/framgia/fels_146/compare/{base}...{head}","merges_url":"https://api.github.com/repos/framgia/fels_146/merges","archive_url":"https://api.github.com/repos/framgia/fels_146/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/framgia/fels_146/downloads","issues_url":"https://api.github.com/repos/framgia/fels_146/issues{/number}","pulls_url":"https://api.github.com/repos/framgia/fels_146/pulls{/number}","milestones_url":"https://api.github.com/repos/framgia/fels_146/milestones{/number}","notifications_url":"https://api.github.com/repos/framgia/fels_146/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/framgia/fels_146/labels{/name}","releases_url":"https://api.github.com/repos/framgia/fels_146/releases{/id}","deployments_url":"https://api.github.com/repos/framgia/fels_146/deployments","created_at":"2016-06-20T05:54:01Z","updated_at":"2016-06-20T05:54:01Z","pushed_at":"2016-06-29T02:37:07Z","git_url":"git://github.com/framgia/fels_146.git","ssh_url":"git@github.com:framgia/fels_146.git","clone_url":"https://github.com/framgia/fels_146.git","svn_url":"https://github.com/framgia/fels_146","homepage":null,"size":83,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":7,"forks":2,"open_issues":7,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/framgia/fels_146/pulls/26"},"html":{"href":"https://github.com/framgia/fels_146/pull/26"},"issue":{"href":"https://api.github.com/repos/framgia/fels_146/issues/26"},"comments":{"href":"https://api.github.com/repos/framgia/fels_146/issues/26/comments"},"review_comments":{"href":"https://api.github.com/repos/framgia/fels_146/pulls/26/comments"},"review_comment":{"href":"https://api.github.com/repos/framgia/fels_146/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/framgia/fels_146/pulls/26/commits"},"statuses":{"href":"https://api.github.com/repos/framgia/fels_146/statuses/8025abdd4921753d4821d23c1ec909bf314b1b14"}}}}
{"actor":{"display_login":"nguyenluc312"}}