{"action":"created","comment":{"url":"https://api.github.com/repos/max-underthesun/TN_repository/pulls/comments/42728383","id":42728383,"diff_hunk":"@@ -5,6 +5,10 @@ class Train < ActiveRecord::Base\n \n   validates :number, presence: true\n \n+  def self.all_trains_on(routes)\n+    routes.map(&:trains).reduce(:+)","path":"lessons_10-plus/tutu/app/models/train.rb","position":5,"original_position":5,"commit_id":"c40d5752910df6b75548a07992ef81a33eb6f892","original_commit_id":"c40d5752910df6b75548a07992ef81a33eb6f892","user":{"login":"vkurennov","id":968537,"avatar_url":"https://avatars.githubusercontent.com/u/968537?v=3","gravatar_id":"","url":"https://api.github.com/users/vkurennov","html_url":"https://github.com/vkurennov","followers_url":"https://api.github.com/users/vkurennov/followers","following_url":"https://api.github.com/users/vkurennov/following{/other_user}","gists_url":"https://api.github.com/users/vkurennov/gists{/gist_id}","starred_url":"https://api.github.com/users/vkurennov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vkurennov/subscriptions","organizations_url":"https://api.github.com/users/vkurennov/orgs","repos_url":"https://api.github.com/users/vkurennov/repos","events_url":"https://api.github.com/users/vkurennov/events{/privacy}","received_events_url":"https://api.github.com/users/vkurennov/received_events","type":"User","site_admin":false},"body":"Если ты здесь получаешь кол-во, то лучше это делать через базу: routes.trains.count. Уходит 1 запрос, который возвращает тебе кол-во поездов у маршрута. Даже и метод для этого отдельный не нужен.","created_at":"2015-10-22T09:38:41Z","updated_at":"2015-10-22T09:38:41Z","html_url":"https://github.com/max-underthesun/TN_repository/pull/8#discussion_r42728383","pull_request_url":"https://api.github.com/repos/max-underthesun/TN_repository/pulls/8","_links":{"self":{"href":"https://api.github.com/repos/max-underthesun/TN_repository/pulls/comments/42728383"},"html":{"href":"https://github.com/max-underthesun/TN_repository/pull/8#discussion_r42728383"},"pull_request":{"href":"https://api.github.com/repos/max-underthesun/TN_repository/pulls/8"}}},"pull_request":{"url":"https://api.github.com/repos/max-underthesun/TN_repository/pulls/8","id":48415336,"html_url":"https://github.com/max-underthesun/TN_repository/pull/8","diff_url":"https://github.com/max-underthesun/TN_repository/pull/8.diff","patch_url":"https://github.com/max-underthesun/TN_repository/pull/8.patch","issue_url":"https://api.github.com/repos/max-underthesun/TN_repository/issues/8","number":8,"state":"open","locked":false,"title":"поиск","user":{"login":"max-underthesun","id":13752607,"avatar_url":"https://avatars.githubusercontent.com/u/13752607?v=3","gravatar_id":"","url":"https://api.github.com/users/max-underthesun","html_url":"https://github.com/max-underthesun","followers_url":"https://api.github.com/users/max-underthesun/followers","following_url":"https://api.github.com/users/max-underthesun/following{/other_user}","gists_url":"https://api.github.com/users/max-underthesun/gists{/gist_id}","starred_url":"https://api.github.com/users/max-underthesun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/max-underthesun/subscriptions","organizations_url":"https://api.github.com/users/max-underthesun/orgs","repos_url":"https://api.github.com/users/max-underthesun/repos","events_url":"https://api.github.com/users/max-underthesun/events{/privacy}","received_events_url":"https://api.github.com/users/max-underthesun/received_events","type":"User","site_admin":false},"body":"пока реализованно без вложенных ресурсов","created_at":"2015-10-22T03:56:56Z","updated_at":"2015-10-22T09:38:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"819f6ead85a747ef5445042c248e221d19ffa0fb","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/max-underthesun/TN_repository/pulls/8/commits","review_comments_url":"https://api.github.com/repos/max-underthesun/TN_repository/pulls/8/comments","review_comment_url":"https://api.github.com/repos/max-underthesun/TN_repository/pulls/comments{/number}","comments_url":"https://api.github.com/repos/max-underthesun/TN_repository/issues/8/comments","statuses_url":"https://api.github.com/repos/max-underthesun/TN_repository/statuses/c40d5752910df6b75548a07992ef81a33eb6f892","head":{"label":"max-underthesun:l16_tickets-search","ref":"l16_tickets-search","sha":"c40d5752910df6b75548a07992ef81a33eb6f892","user":{"login":"max-underthesun","id":13752607,"avatar_url":"https://avatars.githubusercontent.com/u/13752607?v=3","gravatar_id":"","url":"https://api.github.com/users/max-underthesun","html_url":"https://github.com/max-underthesun","followers_url":"https://api.github.com/users/max-underthesun/followers","following_url":"https://api.github.com/users/max-underthesun/following{/other_user}","gists_url":"https://api.github.com/users/max-underthesun/gists{/gist_id}","starred_url":"https://api.github.com/users/max-underthesun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/max-underthesun/subscriptions","organizations_url":"https://api.github.com/users/max-underthesun/orgs","repos_url":"https://api.github.com/users/max-underthesun/repos","events_url":"https://api.github.com/users/max-underthesun/events{/privacy}","received_events_url":"https://api.github.com/users/max-underthesun/received_events","type":"User","site_admin":false},"repo":{"id":40563522,"name":"TN_repository","full_name":"max-underthesun/TN_repository","owner":{"login":"max-underthesun","id":13752607,"avatar_url":"https://avatars.githubusercontent.com/u/13752607?v=3","gravatar_id":"","url":"https://api.github.com/users/max-underthesun","html_url":"https://github.com/max-underthesun","followers_url":"https://api.github.com/users/max-underthesun/followers","following_url":"https://api.github.com/users/max-underthesun/following{/other_user}","gists_url":"https://api.github.com/users/max-underthesun/gists{/gist_id}","starred_url":"https://api.github.com/users/max-underthesun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/max-underthesun/subscriptions","organizations_url":"https://api.github.com/users/max-underthesun/orgs","repos_url":"https://api.github.com/users/max-underthesun/repos","events_url":"https://api.github.com/users/max-underthesun/events{/privacy}","received_events_url":"https://api.github.com/users/max-underthesun/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/max-underthesun/TN_repository","description":"","fork":false,"url":"https://api.github.com/repos/max-underthesun/TN_repository","forks_url":"https://api.github.com/repos/max-underthesun/TN_repository/forks","keys_url":"https://api.github.com/repos/max-underthesun/TN_repository/keys{/key_id}","collaborators_url":"https://api.github.com/repos/max-underthesun/TN_repository/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/max-underthesun/TN_repository/teams","hooks_url":"https://api.github.com/repos/max-underthesun/TN_repository/hooks","issue_events_url":"https://api.github.com/repos/max-underthesun/TN_repository/issues/events{/number}","events_url":"https://api.github.com/repos/max-underthesun/TN_repository/events","assignees_url":"https://api.github.com/repos/max-underthesun/TN_repository/assignees{/user}","branches_url":"https://api.github.com/repos/max-underthesun/TN_repository/branches{/branch}","tags_url":"https://api.github.com/repos/max-underthesun/TN_repository/tags","blobs_url":"https://api.github.com/repos/max-underthesun/TN_repository/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/max-underthesun/TN_repository/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/max-underthesun/TN_repository/git/refs{/sha}","trees_url":"https://api.github.com/repos/max-underthesun/TN_repository/git/trees{/sha}","statuses_url":"https://api.github.com/repos/max-underthesun/TN_repository/statuses/{sha}","languages_url":"https://api.github.com/repos/max-underthesun/TN_repository/languages","stargazers_url":"https://api.github.com/repos/max-underthesun/TN_repository/stargazers","contributors_url":"https://api.github.com/repos/max-underthesun/TN_repository/contributors","subscribers_url":"https://api.github.com/repos/max-underthesun/TN_repository/subscribers","subscription_url":"https://api.github.com/repos/max-underthesun/TN_repository/subscription","commits_url":"https://api.github.com/repos/max-underthesun/TN_repository/commits{/sha}","git_commits_url":"https://api.github.com/repos/max-underthesun/TN_repository/git/commits{/sha}","comments_url":"https://api.github.com/repos/max-underthesun/TN_repository/comments{/number}","issue_comment_url":"https://api.github.com/repos/max-underthesun/TN_repository/issues/comments{/number}","contents_url":"https://api.github.com/repos/max-underthesun/TN_repository/contents/{+path}","compare_url":"https://api.github.com/repos/max-underthesun/TN_repository/compare/{base}...{head}","merges_url":"https://api.github.com/repos/max-underthesun/TN_repository/merges","archive_url":"https://api.github.com/repos/max-underthesun/TN_repository/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/max-underthesun/TN_repository/downloads","issues_url":"https://api.github.com/repos/max-underthesun/TN_repository/issues{/number}","pulls_url":"https://api.github.com/repos/max-underthesun/TN_repository/pulls{/number}","milestones_url":"https://api.github.com/repos/max-underthesun/TN_repository/milestones{/number}","notifications_url":"https://api.github.com/repos/max-underthesun/TN_repository/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/max-underthesun/TN_repository/labels{/name}","releases_url":"https://api.github.com/repos/max-underthesun/TN_repository/releases{/id}","created_at":"2015-08-11T20:25:54Z","updated_at":"2015-08-12T13:44:14Z","pushed_at":"2015-10-22T03:56:56Z","git_url":"git://github.com/max-underthesun/TN_repository.git","ssh_url":"git@github.com:max-underthesun/TN_repository.git","clone_url":"https://github.com/max-underthesun/TN_repository.git","svn_url":"https://github.com/max-underthesun/TN_repository","homepage":null,"size":888,"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":4,"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"base":{"label":"max-underthesun:arriving-departing-times","ref":"arriving-departing-times","sha":"1e55110dccef084567c38f1029c34bc59b642097","user":{"login":"max-underthesun","id":13752607,"avatar_url":"https://avatars.githubusercontent.com/u/13752607?v=3","gravatar_id":"","url":"https://api.github.com/users/max-underthesun","html_url":"https://github.com/max-underthesun","followers_url":"https://api.github.com/users/max-underthesun/followers","following_url":"https://api.github.com/users/max-underthesun/following{/other_user}","gists_url":"https://api.github.com/users/max-underthesun/gists{/gist_id}","starred_url":"https://api.github.com/users/max-underthesun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/max-underthesun/subscriptions","organizations_url":"https://api.github.com/users/max-underthesun/orgs","repos_url":"https://api.github.com/users/max-underthesun/repos","events_url":"https://api.github.com/users/max-underthesun/events{/privacy}","received_events_url":"https://api.github.com/users/max-underthesun/received_events","type":"User","site_admin":false},"repo":{"id":40563522,"name":"TN_repository","full_name":"max-underthesun/TN_repository","owner":{"login":"max-underthesun","id":13752607,"avatar_url":"https://avatars.githubusercontent.com/u/13752607?v=3","gravatar_id":"","url":"https://api.github.com/users/max-underthesun","html_url":"https://github.com/max-underthesun","followers_url":"https://api.github.com/users/max-underthesun/followers","following_url":"https://api.github.com/users/max-underthesun/following{/other_user}","gists_url":"https://api.github.com/users/max-underthesun/gists{/gist_id}","starred_url":"https://api.github.com/users/max-underthesun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/max-underthesun/subscriptions","organizations_url":"https://api.github.com/users/max-underthesun/orgs","repos_url":"https://api.github.com/users/max-underthesun/repos","events_url":"https://api.github.com/users/max-underthesun/events{/privacy}","received_events_url":"https://api.github.com/users/max-underthesun/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/max-underthesun/TN_repository","description":"","fork":false,"url":"https://api.github.com/repos/max-underthesun/TN_repository","forks_url":"https://api.github.com/repos/max-underthesun/TN_repository/forks","keys_url":"https://api.github.com/repos/max-underthesun/TN_repository/keys{/key_id}","collaborators_url":"https://api.github.com/repos/max-underthesun/TN_repository/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/max-underthesun/TN_repository/teams","hooks_url":"https://api.github.com/repos/max-underthesun/TN_repository/hooks","issue_events_url":"https://api.github.com/repos/max-underthesun/TN_repository/issues/events{/number}","events_url":"https://api.github.com/repos/max-underthesun/TN_repository/events","assignees_url":"https://api.github.com/repos/max-underthesun/TN_repository/assignees{/user}","branches_url":"https://api.github.com/repos/max-underthesun/TN_repository/branches{/branch}","tags_url":"https://api.github.com/repos/max-underthesun/TN_repository/tags","blobs_url":"https://api.github.com/repos/max-underthesun/TN_repository/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/max-underthesun/TN_repository/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/max-underthesun/TN_repository/git/refs{/sha}","trees_url":"https://api.github.com/repos/max-underthesun/TN_repository/git/trees{/sha}","statuses_url":"https://api.github.com/repos/max-underthesun/TN_repository/statuses/{sha}","languages_url":"https://api.github.com/repos/max-underthesun/TN_repository/languages","stargazers_url":"https://api.github.com/repos/max-underthesun/TN_repository/stargazers","contributors_url":"https://api.github.com/repos/max-underthesun/TN_repository/contributors","subscribers_url":"https://api.github.com/repos/max-underthesun/TN_repository/subscribers","subscription_url":"https://api.github.com/repos/max-underthesun/TN_repository/subscription","commits_url":"https://api.github.com/repos/max-underthesun/TN_repository/commits{/sha}","git_commits_url":"https://api.github.com/repos/max-underthesun/TN_repository/git/commits{/sha}","comments_url":"https://api.github.com/repos/max-underthesun/TN_repository/comments{/number}","issue_comment_url":"https://api.github.com/repos/max-underthesun/TN_repository/issues/comments{/number}","contents_url":"https://api.github.com/repos/max-underthesun/TN_repository/contents/{+path}","compare_url":"https://api.github.com/repos/max-underthesun/TN_repository/compare/{base}...{head}","merges_url":"https://api.github.com/repos/max-underthesun/TN_repository/merges","archive_url":"https://api.github.com/repos/max-underthesun/TN_repository/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/max-underthesun/TN_repository/downloads","issues_url":"https://api.github.com/repos/max-underthesun/TN_repository/issues{/number}","pulls_url":"https://api.github.com/repos/max-underthesun/TN_repository/pulls{/number}","milestones_url":"https://api.github.com/repos/max-underthesun/TN_repository/milestones{/number}","notifications_url":"https://api.github.com/repos/max-underthesun/TN_repository/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/max-underthesun/TN_repository/labels{/name}","releases_url":"https://api.github.com/repos/max-underthesun/TN_repository/releases{/id}","created_at":"2015-08-11T20:25:54Z","updated_at":"2015-08-12T13:44:14Z","pushed_at":"2015-10-22T03:56:56Z","git_url":"git://github.com/max-underthesun/TN_repository.git","ssh_url":"git@github.com:max-underthesun/TN_repository.git","clone_url":"https://github.com/max-underthesun/TN_repository.git","svn_url":"https://github.com/max-underthesun/TN_repository","homepage":null,"size":888,"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":4,"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/max-underthesun/TN_repository/pulls/8"},"html":{"href":"https://github.com/max-underthesun/TN_repository/pull/8"},"issue":{"href":"https://api.github.com/repos/max-underthesun/TN_repository/issues/8"},"comments":{"href":"https://api.github.com/repos/max-underthesun/TN_repository/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/max-underthesun/TN_repository/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/max-underthesun/TN_repository/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/max-underthesun/TN_repository/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/max-underthesun/TN_repository/statuses/c40d5752910df6b75548a07992ef81a33eb6f892"}}}}