{"action":"created","comment":{"url":"https://api.github.com/repos/ruby-china/ruby-china/pulls/comments/64704560","id":64704560,"diff_hunk":"@@ -8,7 +8,7 @@ def feed_node_topics_url\n   def index\n     @node = Node.find(Node.jobs_id)\n     @suggest_topics = Topic.where(node_id: @node.id).suggest.limit(3)\n-    suggest_topic_ids = @suggest_topics.map(&:id)\n+    suggest_topic_ids = @suggest_topics.pluck(:id)","path":"app/controllers/jobs_controller.rb","position":5,"original_position":5,"commit_id":"c44bc89d05c6af7f9eee100c45293f742d278751","original_commit_id":"c44bc89d05c6af7f9eee100c45293f742d278751","user":{"login":"songjiayang","id":1459834,"avatar_url":"https://avatars.githubusercontent.com/u/1459834?v=3","gravatar_id":"","url":"https://api.github.com/users/songjiayang","html_url":"https://github.com/songjiayang","followers_url":"https://api.github.com/users/songjiayang/followers","following_url":"https://api.github.com/users/songjiayang/following{/other_user}","gists_url":"https://api.github.com/users/songjiayang/gists{/gist_id}","starred_url":"https://api.github.com/users/songjiayang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/songjiayang/subscriptions","organizations_url":"https://api.github.com/users/songjiayang/orgs","repos_url":"https://api.github.com/users/songjiayang/repos","events_url":"https://api.github.com/users/songjiayang/events{/privacy}","received_events_url":"https://api.github.com/users/songjiayang/received_events","type":"User","site_admin":false},"body":"ok，认同","created_at":"2016-05-26T07:57:46Z","updated_at":"2016-05-26T07:57:46Z","html_url":"https://github.com/ruby-china/ruby-china/pull/664#discussion_r64704560","pull_request_url":"https://api.github.com/repos/ruby-china/ruby-china/pulls/664","_links":{"self":{"href":"https://api.github.com/repos/ruby-china/ruby-china/pulls/comments/64704560"},"html":{"href":"https://github.com/ruby-china/ruby-china/pull/664#discussion_r64704560"},"pull_request":{"href":"https://api.github.com/repos/ruby-china/ruby-china/pulls/664"}}},"pull_request":{"url":"https://api.github.com/repos/ruby-china/ruby-china/pulls/664","id":71505708,"html_url":"https://github.com/ruby-china/ruby-china/pull/664","diff_url":"https://github.com/ruby-china/ruby-china/pull/664.diff","patch_url":"https://github.com/ruby-china/ruby-china/pull/664.patch","issue_url":"https://api.github.com/repos/ruby-china/ruby-china/issues/664","number":664,"state":"open","locked":false,"title":"refactor TopicsController's index action","user":{"login":"songjiayang","id":1459834,"avatar_url":"https://avatars.githubusercontent.com/u/1459834?v=3","gravatar_id":"","url":"https://api.github.com/users/songjiayang","html_url":"https://github.com/songjiayang","followers_url":"https://api.github.com/users/songjiayang/followers","following_url":"https://api.github.com/users/songjiayang/following{/other_user}","gists_url":"https://api.github.com/users/songjiayang/gists{/gist_id}","starred_url":"https://api.github.com/users/songjiayang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/songjiayang/subscriptions","organizations_url":"https://api.github.com/users/songjiayang/orgs","repos_url":"https://api.github.com/users/songjiayang/repos","events_url":"https://api.github.com/users/songjiayang/events{/privacy}","received_events_url":"https://api.github.com/users/songjiayang/received_events","type":"User","site_admin":false},"body":"看过 rails 的 cache key 生成代码，觉得添加个 ActiveRecord::Relation 的 case 比较方便。\r\n``` ruby\r\ndef expanded_key(key) # :nodoc:\r\n  return key.cache_key.to_s if key.respond_to?(:cache_key)\r\n\r\n  case key\r\n  when Array\r\n    if key.size > 1\r\n      key = key.collect{|element| expanded_key(element)}\r\n    else\r\n      key = key.first\r\n    end\r\n  when Hash\r\n    key = key.sort_by { |k,_| k.to_s }.collect{|k,v| \"#{k}=#{v}\"}\r\n  end\r\n\r\n  key.to_param\r\nend\r\n\r\n```\r\n\r\n","created_at":"2016-05-26T06:21:26Z","updated_at":"2016-05-26T07:57:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"331c39a386d133458adf87e685955757727dfede","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ruby-china/ruby-china/pulls/664/commits","review_comments_url":"https://api.github.com/repos/ruby-china/ruby-china/pulls/664/comments","review_comment_url":"https://api.github.com/repos/ruby-china/ruby-china/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ruby-china/ruby-china/issues/664/comments","statuses_url":"https://api.github.com/repos/ruby-china/ruby-china/statuses/c44bc89d05c6af7f9eee100c45293f742d278751","head":{"label":"songjiayang:topic_controller_index_refactor","ref":"topic_controller_index_refactor","sha":"c44bc89d05c6af7f9eee100c45293f742d278751","user":{"login":"songjiayang","id":1459834,"avatar_url":"https://avatars.githubusercontent.com/u/1459834?v=3","gravatar_id":"","url":"https://api.github.com/users/songjiayang","html_url":"https://github.com/songjiayang","followers_url":"https://api.github.com/users/songjiayang/followers","following_url":"https://api.github.com/users/songjiayang/following{/other_user}","gists_url":"https://api.github.com/users/songjiayang/gists{/gist_id}","starred_url":"https://api.github.com/users/songjiayang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/songjiayang/subscriptions","organizations_url":"https://api.github.com/users/songjiayang/orgs","repos_url":"https://api.github.com/users/songjiayang/repos","events_url":"https://api.github.com/users/songjiayang/events{/privacy}","received_events_url":"https://api.github.com/users/songjiayang/received_events","type":"User","site_admin":false},"repo":{"id":22014717,"name":"ruby-china","full_name":"songjiayang/ruby-china","owner":{"login":"songjiayang","id":1459834,"avatar_url":"https://avatars.githubusercontent.com/u/1459834?v=3","gravatar_id":"","url":"https://api.github.com/users/songjiayang","html_url":"https://github.com/songjiayang","followers_url":"https://api.github.com/users/songjiayang/followers","following_url":"https://api.github.com/users/songjiayang/following{/other_user}","gists_url":"https://api.github.com/users/songjiayang/gists{/gist_id}","starred_url":"https://api.github.com/users/songjiayang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/songjiayang/subscriptions","organizations_url":"https://api.github.com/users/songjiayang/orgs","repos_url":"https://api.github.com/users/songjiayang/repos","events_url":"https://api.github.com/users/songjiayang/events{/privacy}","received_events_url":"https://api.github.com/users/songjiayang/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/songjiayang/ruby-china","description":"ruby-china.org website source code.","fork":true,"url":"https://api.github.com/repos/songjiayang/ruby-china","forks_url":"https://api.github.com/repos/songjiayang/ruby-china/forks","keys_url":"https://api.github.com/repos/songjiayang/ruby-china/keys{/key_id}","collaborators_url":"https://api.github.com/repos/songjiayang/ruby-china/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/songjiayang/ruby-china/teams","hooks_url":"https://api.github.com/repos/songjiayang/ruby-china/hooks","issue_events_url":"https://api.github.com/repos/songjiayang/ruby-china/issues/events{/number}","events_url":"https://api.github.com/repos/songjiayang/ruby-china/events","assignees_url":"https://api.github.com/repos/songjiayang/ruby-china/assignees{/user}","branches_url":"https://api.github.com/repos/songjiayang/ruby-china/branches{/branch}","tags_url":"https://api.github.com/repos/songjiayang/ruby-china/tags","blobs_url":"https://api.github.com/repos/songjiayang/ruby-china/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/songjiayang/ruby-china/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/songjiayang/ruby-china/git/refs{/sha}","trees_url":"https://api.github.com/repos/songjiayang/ruby-china/git/trees{/sha}","statuses_url":"https://api.github.com/repos/songjiayang/ruby-china/statuses/{sha}","languages_url":"https://api.github.com/repos/songjiayang/ruby-china/languages","stargazers_url":"https://api.github.com/repos/songjiayang/ruby-china/stargazers","contributors_url":"https://api.github.com/repos/songjiayang/ruby-china/contributors","subscribers_url":"https://api.github.com/repos/songjiayang/ruby-china/subscribers","subscription_url":"https://api.github.com/repos/songjiayang/ruby-china/subscription","commits_url":"https://api.github.com/repos/songjiayang/ruby-china/commits{/sha}","git_commits_url":"https://api.github.com/repos/songjiayang/ruby-china/git/commits{/sha}","comments_url":"https://api.github.com/repos/songjiayang/ruby-china/comments{/number}","issue_comment_url":"https://api.github.com/repos/songjiayang/ruby-china/issues/comments{/number}","contents_url":"https://api.github.com/repos/songjiayang/ruby-china/contents/{+path}","compare_url":"https://api.github.com/repos/songjiayang/ruby-china/compare/{base}...{head}","merges_url":"https://api.github.com/repos/songjiayang/ruby-china/merges","archive_url":"https://api.github.com/repos/songjiayang/ruby-china/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/songjiayang/ruby-china/downloads","issues_url":"https://api.github.com/repos/songjiayang/ruby-china/issues{/number}","pulls_url":"https://api.github.com/repos/songjiayang/ruby-china/pulls{/number}","milestones_url":"https://api.github.com/repos/songjiayang/ruby-china/milestones{/number}","notifications_url":"https://api.github.com/repos/songjiayang/ruby-china/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/songjiayang/ruby-china/labels{/name}","releases_url":"https://api.github.com/repos/songjiayang/ruby-china/releases{/id}","deployments_url":"https://api.github.com/repos/songjiayang/ruby-china/deployments","created_at":"2014-07-19T17:08:30Z","updated_at":"2016-01-20T06:45:27Z","pushed_at":"2016-05-26T06:17:53Z","git_url":"git://github.com/songjiayang/ruby-china.git","ssh_url":"git@github.com:songjiayang/ruby-china.git","clone_url":"https://github.com/songjiayang/ruby-china.git","svn_url":"https://github.com/songjiayang/ruby-china","homepage":"http://ruby-china.org","size":24725,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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":"ruby-china:master","ref":"master","sha":"3d330e16bb3fabf6c81122a55a4071417dcb54a5","user":{"login":"ruby-china","id":1331033,"avatar_url":"https://avatars.githubusercontent.com/u/1331033?v=3","gravatar_id":"","url":"https://api.github.com/users/ruby-china","html_url":"https://github.com/ruby-china","followers_url":"https://api.github.com/users/ruby-china/followers","following_url":"https://api.github.com/users/ruby-china/following{/other_user}","gists_url":"https://api.github.com/users/ruby-china/gists{/gist_id}","starred_url":"https://api.github.com/users/ruby-china/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruby-china/subscriptions","organizations_url":"https://api.github.com/users/ruby-china/orgs","repos_url":"https://api.github.com/users/ruby-china/repos","events_url":"https://api.github.com/users/ruby-china/events{/privacy}","received_events_url":"https://api.github.com/users/ruby-china/received_events","type":"Organization","site_admin":false},"repo":{"id":3842593,"name":"ruby-china","full_name":"ruby-china/ruby-china","owner":{"login":"ruby-china","id":1331033,"avatar_url":"https://avatars.githubusercontent.com/u/1331033?v=3","gravatar_id":"","url":"https://api.github.com/users/ruby-china","html_url":"https://github.com/ruby-china","followers_url":"https://api.github.com/users/ruby-china/followers","following_url":"https://api.github.com/users/ruby-china/following{/other_user}","gists_url":"https://api.github.com/users/ruby-china/gists{/gist_id}","starred_url":"https://api.github.com/users/ruby-china/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruby-china/subscriptions","organizations_url":"https://api.github.com/users/ruby-china/orgs","repos_url":"https://api.github.com/users/ruby-china/repos","events_url":"https://api.github.com/users/ruby-china/events{/privacy}","received_events_url":"https://api.github.com/users/ruby-china/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ruby-china/ruby-china","description":":circus_tent: Ruby China website source code.","fork":true,"url":"https://api.github.com/repos/ruby-china/ruby-china","forks_url":"https://api.github.com/repos/ruby-china/ruby-china/forks","keys_url":"https://api.github.com/repos/ruby-china/ruby-china/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ruby-china/ruby-china/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ruby-china/ruby-china/teams","hooks_url":"https://api.github.com/repos/ruby-china/ruby-china/hooks","issue_events_url":"https://api.github.com/repos/ruby-china/ruby-china/issues/events{/number}","events_url":"https://api.github.com/repos/ruby-china/ruby-china/events","assignees_url":"https://api.github.com/repos/ruby-china/ruby-china/assignees{/user}","branches_url":"https://api.github.com/repos/ruby-china/ruby-china/branches{/branch}","tags_url":"https://api.github.com/repos/ruby-china/ruby-china/tags","blobs_url":"https://api.github.com/repos/ruby-china/ruby-china/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ruby-china/ruby-china/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ruby-china/ruby-china/git/refs{/sha}","trees_url":"https://api.github.com/repos/ruby-china/ruby-china/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ruby-china/ruby-china/statuses/{sha}","languages_url":"https://api.github.com/repos/ruby-china/ruby-china/languages","stargazers_url":"https://api.github.com/repos/ruby-china/ruby-china/stargazers","contributors_url":"https://api.github.com/repos/ruby-china/ruby-china/contributors","subscribers_url":"https://api.github.com/repos/ruby-china/ruby-china/subscribers","subscription_url":"https://api.github.com/repos/ruby-china/ruby-china/subscription","commits_url":"https://api.github.com/repos/ruby-china/ruby-china/commits{/sha}","git_commits_url":"https://api.github.com/repos/ruby-china/ruby-china/git/commits{/sha}","comments_url":"https://api.github.com/repos/ruby-china/ruby-china/comments{/number}","issue_comment_url":"https://api.github.com/repos/ruby-china/ruby-china/issues/comments{/number}","contents_url":"https://api.github.com/repos/ruby-china/ruby-china/contents/{+path}","compare_url":"https://api.github.com/repos/ruby-china/ruby-china/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ruby-china/ruby-china/merges","archive_url":"https://api.github.com/repos/ruby-china/ruby-china/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ruby-china/ruby-china/downloads","issues_url":"https://api.github.com/repos/ruby-china/ruby-china/issues{/number}","pulls_url":"https://api.github.com/repos/ruby-china/ruby-china/pulls{/number}","milestones_url":"https://api.github.com/repos/ruby-china/ruby-china/milestones{/number}","notifications_url":"https://api.github.com/repos/ruby-china/ruby-china/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ruby-china/ruby-china/labels{/name}","releases_url":"https://api.github.com/repos/ruby-china/ruby-china/releases{/id}","deployments_url":"https://api.github.com/repos/ruby-china/ruby-china/deployments","created_at":"2012-03-27T10:26:23Z","updated_at":"2016-05-26T05:58:01Z","pushed_at":"2016-05-26T06:21:26Z","git_url":"git://github.com/ruby-china/ruby-china.git","ssh_url":"git@github.com:ruby-china/ruby-china.git","clone_url":"https://github.com/ruby-china/ruby-china.git","svn_url":"https://github.com/ruby-china/ruby-china","homepage":"https://ruby-china.org","size":26222,"stargazers_count":1917,"watchers_count":1917,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":866,"mirror_url":null,"open_issues_count":27,"forks":866,"open_issues":27,"watchers":1917,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ruby-china/ruby-china/pulls/664"},"html":{"href":"https://github.com/ruby-china/ruby-china/pull/664"},"issue":{"href":"https://api.github.com/repos/ruby-china/ruby-china/issues/664"},"comments":{"href":"https://api.github.com/repos/ruby-china/ruby-china/issues/664/comments"},"review_comments":{"href":"https://api.github.com/repos/ruby-china/ruby-china/pulls/664/comments"},"review_comment":{"href":"https://api.github.com/repos/ruby-china/ruby-china/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ruby-china/ruby-china/pulls/664/commits"},"statuses":{"href":"https://api.github.com/repos/ruby-china/ruby-china/statuses/c44bc89d05c6af7f9eee100c45293f742d278751"}}}}
{"actor":{"display_login":"songjiayang"}}