{"action":"created","issue":{"url":"https://api.github.com/repos/naoki2bota/chat-space/issues/26","repository_url":"https://api.github.com/repos/naoki2bota/chat-space","labels_url":"https://api.github.com/repos/naoki2bota/chat-space/issues/26/labels{/name}","comments_url":"https://api.github.com/repos/naoki2bota/chat-space/issues/26/comments","events_url":"https://api.github.com/repos/naoki2bota/chat-space/issues/26/events","html_url":"https://github.com/naoki2bota/chat-space/pull/26","id":191785681,"number":26,"title":"自動更新機能の実装","user":{"login":"naoki2bota","id":23024888,"avatar_url":"https://avatars.githubusercontent.com/u/23024888?v=3","gravatar_id":"","url":"https://api.github.com/users/naoki2bota","html_url":"https://github.com/naoki2bota","followers_url":"https://api.github.com/users/naoki2bota/followers","following_url":"https://api.github.com/users/naoki2bota/following{/other_user}","gists_url":"https://api.github.com/users/naoki2bota/gists{/gist_id}","starred_url":"https://api.github.com/users/naoki2bota/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/naoki2bota/subscriptions","organizations_url":"https://api.github.com/users/naoki2bota/orgs","repos_url":"https://api.github.com/users/naoki2bota/repos","events_url":"https://api.github.com/users/naoki2bota/events{/privacy}","received_events_url":"https://api.github.com/users/naoki2bota/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-11-26T04:11:44Z","updated_at":"2016-11-28T16:55:14Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/naoki2bota/chat-space/pulls/26","html_url":"https://github.com/naoki2bota/chat-space/pull/26","diff_url":"https://github.com/naoki2bota/chat-space/pull/26.diff","patch_url":"https://github.com/naoki2bota/chat-space/pull/26.patch"},"body":"## WHAT\r\n自動更新機能の実装\r\n-------------Railsの処理---------------------\r\n①A)全レコード(@messages)、送ったidの値を基準にB)画面に表示されているレコード(@nowmessages)とC)増えた差分レコード(@addmessages)を定義。\r\n②A)とB)を比較してA)が多い場合はC)を返す\r\n③返す前に配列をカスタマイズして新しく用意した配列(@appendmessages)に再代入。アソシーエーションでuserモデルのnameを取得する。\r\n④@appendmessagesをjsonで返す。\r\n-----------messages.jsの処理---------------------------\r\n①ajaxでmessages_controllerのindexアクションにリクエストを送る。（画面に表示されているレコード=<li></li>の数をidパラメとして送る）\r\n②返ってきたメッセージをdone()の中で追加描画(addMessage();)\r\n③スクロール(scroll();)\r\n\r\n## WHY\r\n別のユーザーが投稿したらそのメッセージを更新表示するため"},"comment":{"url":"https://api.github.com/repos/naoki2bota/chat-space/issues/comments/263326355","html_url":"https://github.com/naoki2bota/chat-space/pull/26#issuecomment-263326355","issue_url":"https://api.github.com/repos/naoki2bota/chat-space/issues/26","id":263326355,"user":{"login":"naoki2bota","id":23024888,"avatar_url":"https://avatars.githubusercontent.com/u/23024888?v=3","gravatar_id":"","url":"https://api.github.com/users/naoki2bota","html_url":"https://github.com/naoki2bota","followers_url":"https://api.github.com/users/naoki2bota/followers","following_url":"https://api.github.com/users/naoki2bota/following{/other_user}","gists_url":"https://api.github.com/users/naoki2bota/gists{/gist_id}","starred_url":"https://api.github.com/users/naoki2bota/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/naoki2bota/subscriptions","organizations_url":"https://api.github.com/users/naoki2bota/orgs","repos_url":"https://api.github.com/users/naoki2bota/repos","events_url":"https://api.github.com/users/naoki2bota/events{/privacy}","received_events_url":"https://api.github.com/users/naoki2bota/received_events","type":"User","site_admin":false},"created_at":"2016-11-28T16:55:14Z","updated_at":"2016-11-28T16:55:14Z","body":"![default](https://cloud.githubusercontent.com/assets/23024888/20677535/b7ecfbc2-b5d6-11e6-8260-27b749068dff.gif)\r\n![default](https://cloud.githubusercontent.com/assets/23024888/20677588/d54805c2-b5d6-11e6-8653-fb4942c01b85.gif)\r\n"}}
{"actor":{"display_login":"naoki2bota"}}