{"action":"created","comment":{"url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/pulls/comments/68487097","id":68487097,"diff_hunk":"@@ -10,11 +10,19 @@ class Answer < ActiveRecord::Base\n \n   validates :question_id, :body, :user_id, presence: true\n \n+  after_commit :notify_subscribers, on: :create\n+\n   def toggle_best\n     transaction do\n       toggle :is_best\n       question.answers.where(is_best: true).update_all(is_best: false) if is_best?\n       save!\n     end\n   end\n+\n+  private\n+\n+  def notify_subscribers\n+    QuestionNotificationJob.perform_later(self) if self.persisted?","path":"app/models/answer.rb","position":17,"original_position":17,"commit_id":"b4e8dd3bd136c44c0d6c862be397bdf02e767322","original_commit_id":"b4e8dd3bd136c44c0d6c862be397bdf02e767322","user":{"login":"palkan","id":1516722,"avatar_url":"https://avatars.githubusercontent.com/u/1516722?v=3","gravatar_id":"","url":"https://api.github.com/users/palkan","html_url":"https://github.com/palkan","followers_url":"https://api.github.com/users/palkan/followers","following_url":"https://api.github.com/users/palkan/following{/other_user}","gists_url":"https://api.github.com/users/palkan/gists{/gist_id}","starred_url":"https://api.github.com/users/palkan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palkan/subscriptions","organizations_url":"https://api.github.com/users/palkan/orgs","repos_url":"https://api.github.com/users/palkan/repos","events_url":"https://api.github.com/users/palkan/events{/privacy}","received_events_url":"https://api.github.com/users/palkan/received_events","type":"User","site_admin":false},"body":"А вот проверять на `persisted?` тут не нужно, здесь не может быть не `persisted?`","created_at":"2016-06-25T10:07:00Z","updated_at":"2016-06-25T10:07:00Z","html_url":"https://github.com/gnomePasaran/thinknetic_proj/pull/18#discussion_r68487097","pull_request_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/pulls/18","_links":{"self":{"href":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/pulls/comments/68487097"},"html":{"href":"https://github.com/gnomePasaran/thinknetic_proj/pull/18#discussion_r68487097"},"pull_request":{"href":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/pulls/18"}}},"pull_request":{"url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/pulls/18","id":75121223,"html_url":"https://github.com/gnomePasaran/thinknetic_proj/pull/18","diff_url":"https://github.com/gnomePasaran/thinknetic_proj/pull/18.diff","patch_url":"https://github.com/gnomePasaran/thinknetic_proj/pull/18.patch","issue_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/issues/18","number":18,"state":"open","locked":false,"title":"Seventeenth lesson","user":{"login":"gnomePasaran","id":18676063,"avatar_url":"https://avatars.githubusercontent.com/u/18676063?v=3","gravatar_id":"","url":"https://api.github.com/users/gnomePasaran","html_url":"https://github.com/gnomePasaran","followers_url":"https://api.github.com/users/gnomePasaran/followers","following_url":"https://api.github.com/users/gnomePasaran/following{/other_user}","gists_url":"https://api.github.com/users/gnomePasaran/gists{/gist_id}","starred_url":"https://api.github.com/users/gnomePasaran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gnomePasaran/subscriptions","organizations_url":"https://api.github.com/users/gnomePasaran/orgs","repos_url":"https://api.github.com/users/gnomePasaran/repos","events_url":"https://api.github.com/users/gnomePasaran/events{/privacy}","received_events_url":"https://api.github.com/users/gnomePasaran/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-06-24T14:21:58Z","updated_at":"2016-06-25T10:07:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6fdae82c97824635898cb1699cdeba73125f335b","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/pulls/18/commits","review_comments_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/pulls/18/comments","review_comment_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/issues/18/comments","statuses_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/statuses/b4e8dd3bd136c44c0d6c862be397bdf02e767322","head":{"label":"gnomePasaran:seventeenth_lesson","ref":"seventeenth_lesson","sha":"b4e8dd3bd136c44c0d6c862be397bdf02e767322","user":{"login":"gnomePasaran","id":18676063,"avatar_url":"https://avatars.githubusercontent.com/u/18676063?v=3","gravatar_id":"","url":"https://api.github.com/users/gnomePasaran","html_url":"https://github.com/gnomePasaran","followers_url":"https://api.github.com/users/gnomePasaran/followers","following_url":"https://api.github.com/users/gnomePasaran/following{/other_user}","gists_url":"https://api.github.com/users/gnomePasaran/gists{/gist_id}","starred_url":"https://api.github.com/users/gnomePasaran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gnomePasaran/subscriptions","organizations_url":"https://api.github.com/users/gnomePasaran/orgs","repos_url":"https://api.github.com/users/gnomePasaran/repos","events_url":"https://api.github.com/users/gnomePasaran/events{/privacy}","received_events_url":"https://api.github.com/users/gnomePasaran/received_events","type":"User","site_admin":false},"repo":{"id":57111612,"name":"thinknetic_proj","full_name":"gnomePasaran/thinknetic_proj","owner":{"login":"gnomePasaran","id":18676063,"avatar_url":"https://avatars.githubusercontent.com/u/18676063?v=3","gravatar_id":"","url":"https://api.github.com/users/gnomePasaran","html_url":"https://github.com/gnomePasaran","followers_url":"https://api.github.com/users/gnomePasaran/followers","following_url":"https://api.github.com/users/gnomePasaran/following{/other_user}","gists_url":"https://api.github.com/users/gnomePasaran/gists{/gist_id}","starred_url":"https://api.github.com/users/gnomePasaran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gnomePasaran/subscriptions","organizations_url":"https://api.github.com/users/gnomePasaran/orgs","repos_url":"https://api.github.com/users/gnomePasaran/repos","events_url":"https://api.github.com/users/gnomePasaran/events{/privacy}","received_events_url":"https://api.github.com/users/gnomePasaran/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gnomePasaran/thinknetic_proj","description":"My learning proj on RoR","fork":false,"url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj","forks_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/forks","keys_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/teams","hooks_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/hooks","issue_events_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/issues/events{/number}","events_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/events","assignees_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/assignees{/user}","branches_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/branches{/branch}","tags_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/tags","blobs_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/git/refs{/sha}","trees_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/statuses/{sha}","languages_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/languages","stargazers_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/stargazers","contributors_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/contributors","subscribers_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/subscribers","subscription_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/subscription","commits_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/commits{/sha}","git_commits_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/git/commits{/sha}","comments_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/comments{/number}","issue_comment_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/issues/comments{/number}","contents_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/contents/{+path}","compare_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/merges","archive_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/downloads","issues_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/issues{/number}","pulls_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/pulls{/number}","milestones_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/milestones{/number}","notifications_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/labels{/name}","releases_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/releases{/id}","deployments_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/deployments","created_at":"2016-04-26T08:32:45Z","updated_at":"2016-04-26T09:11:49Z","pushed_at":"2016-06-24T14:21:58Z","git_url":"git://github.com/gnomePasaran/thinknetic_proj.git","ssh_url":"git@github.com:gnomePasaran/thinknetic_proj.git","clone_url":"https://github.com/gnomePasaran/thinknetic_proj.git","svn_url":"https://github.com/gnomePasaran/thinknetic_proj","homepage":null,"size":255,"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":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"gnomePasaran:master","ref":"master","sha":"c45884fe5e0dc223ceff494a097bdc37a07c0da7","user":{"login":"gnomePasaran","id":18676063,"avatar_url":"https://avatars.githubusercontent.com/u/18676063?v=3","gravatar_id":"","url":"https://api.github.com/users/gnomePasaran","html_url":"https://github.com/gnomePasaran","followers_url":"https://api.github.com/users/gnomePasaran/followers","following_url":"https://api.github.com/users/gnomePasaran/following{/other_user}","gists_url":"https://api.github.com/users/gnomePasaran/gists{/gist_id}","starred_url":"https://api.github.com/users/gnomePasaran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gnomePasaran/subscriptions","organizations_url":"https://api.github.com/users/gnomePasaran/orgs","repos_url":"https://api.github.com/users/gnomePasaran/repos","events_url":"https://api.github.com/users/gnomePasaran/events{/privacy}","received_events_url":"https://api.github.com/users/gnomePasaran/received_events","type":"User","site_admin":false},"repo":{"id":57111612,"name":"thinknetic_proj","full_name":"gnomePasaran/thinknetic_proj","owner":{"login":"gnomePasaran","id":18676063,"avatar_url":"https://avatars.githubusercontent.com/u/18676063?v=3","gravatar_id":"","url":"https://api.github.com/users/gnomePasaran","html_url":"https://github.com/gnomePasaran","followers_url":"https://api.github.com/users/gnomePasaran/followers","following_url":"https://api.github.com/users/gnomePasaran/following{/other_user}","gists_url":"https://api.github.com/users/gnomePasaran/gists{/gist_id}","starred_url":"https://api.github.com/users/gnomePasaran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gnomePasaran/subscriptions","organizations_url":"https://api.github.com/users/gnomePasaran/orgs","repos_url":"https://api.github.com/users/gnomePasaran/repos","events_url":"https://api.github.com/users/gnomePasaran/events{/privacy}","received_events_url":"https://api.github.com/users/gnomePasaran/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gnomePasaran/thinknetic_proj","description":"My learning proj on RoR","fork":false,"url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj","forks_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/forks","keys_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/teams","hooks_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/hooks","issue_events_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/issues/events{/number}","events_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/events","assignees_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/assignees{/user}","branches_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/branches{/branch}","tags_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/tags","blobs_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/git/refs{/sha}","trees_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/statuses/{sha}","languages_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/languages","stargazers_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/stargazers","contributors_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/contributors","subscribers_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/subscribers","subscription_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/subscription","commits_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/commits{/sha}","git_commits_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/git/commits{/sha}","comments_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/comments{/number}","issue_comment_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/issues/comments{/number}","contents_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/contents/{+path}","compare_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/merges","archive_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/downloads","issues_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/issues{/number}","pulls_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/pulls{/number}","milestones_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/milestones{/number}","notifications_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/labels{/name}","releases_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/releases{/id}","deployments_url":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/deployments","created_at":"2016-04-26T08:32:45Z","updated_at":"2016-04-26T09:11:49Z","pushed_at":"2016-06-24T14:21:58Z","git_url":"git://github.com/gnomePasaran/thinknetic_proj.git","ssh_url":"git@github.com:gnomePasaran/thinknetic_proj.git","clone_url":"https://github.com/gnomePasaran/thinknetic_proj.git","svn_url":"https://github.com/gnomePasaran/thinknetic_proj","homepage":null,"size":255,"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":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/pulls/18"},"html":{"href":"https://github.com/gnomePasaran/thinknetic_proj/pull/18"},"issue":{"href":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/issues/18"},"comments":{"href":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/issues/18/comments"},"review_comments":{"href":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/pulls/18/comments"},"review_comment":{"href":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/pulls/18/commits"},"statuses":{"href":"https://api.github.com/repos/gnomePasaran/thinknetic_proj/statuses/b4e8dd3bd136c44c0d6c862be397bdf02e767322"}}}}
{"actor":{"display_login":"palkan"}}