{"action":"created","comment":{"url":"https://api.github.com/repos/slate-studio/ants/pulls/comments/48835466","id":48835466,"diff_hunk":"@@ -0,0 +1,26 @@\n+require \"test_helper\"\n+\n+class SortedRelationsTest < ActiveSupport::TestCase\n+  test \"sorted_relations_for shoud persist for N to N relation\" do\n+    book = Book.create(title: \"The Art of War\")\n+    book.sorted_author_ids = [Author.create(name: \"Sun Tzu\").id,\n+                              Author.create(name: \"Sun Wu\" ).id,\n+                              Author.create(name: \"Lao Zi\" ).id]\n+    book.save\n+    book.reload\n+    book.sorted_author_ids = book.author_ids.map(&:to_s).reverse\n+    assert_equal([\"Lao Zi\", \"Sun Wu\", \"Sun Tzu\"], book.sorted_authors.map(&:name))\n+  end\n+\n+  test \"sorted_relations_for shoud persist for 1 to N relation\" do\n+    book = Book.create(title: \"War and Piece\")\n+    book.sorted_chapter_ids = [Chapter.create(title: \"The End\").id,\n+                               Chapter.create(title: \"Part 3\").id,\n+                               Chapter.create(title: \"Part 2\").id,\n+                               Chapter.create(title: \"Part 1\").id,\n+                               Chapter.create(title: \"Intro\").id]\n+    book.reload\n+    book.sorted_chapter_ids = book.chapter_ids.map(&:to_s).reverse\n+    assert_equal([\"Intro\", \"Part 1\", \"Part 2\", \"Part 3\", \"The End\"], book.sorted_chapters.map(&:title))","path":"test/concerns/sorted_relations_test.rb","position":24,"original_position":24,"commit_id":"580461499d1ac72476b42b35f9bdaa77ebed38fe","original_commit_id":"580461499d1ac72476b42b35f9bdaa77ebed38fe","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Line is too long. [103/80]","created_at":"2016-01-05T11:24:14Z","updated_at":"2016-01-05T11:24:14Z","html_url":"https://github.com/slate-studio/ants/pull/6#discussion_r48835466","pull_request_url":"https://api.github.com/repos/slate-studio/ants/pulls/6","_links":{"self":{"href":"https://api.github.com/repos/slate-studio/ants/pulls/comments/48835466"},"html":{"href":"https://github.com/slate-studio/ants/pull/6#discussion_r48835466"},"pull_request":{"href":"https://api.github.com/repos/slate-studio/ants/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/slate-studio/ants/pulls/6","id":55069436,"html_url":"https://github.com/slate-studio/ants/pull/6","diff_url":"https://github.com/slate-studio/ants/pull/6.diff","patch_url":"https://github.com/slate-studio/ants/pull/6.patch","issue_url":"https://api.github.com/repos/slate-studio/ants/issues/6","number":6,"state":"open","locked":false,"title":"Feature/mm rails app","user":{"login":"nkumeiko","id":945333,"avatar_url":"https://avatars.githubusercontent.com/u/945333?v=3","gravatar_id":"","url":"https://api.github.com/users/nkumeiko","html_url":"https://github.com/nkumeiko","followers_url":"https://api.github.com/users/nkumeiko/followers","following_url":"https://api.github.com/users/nkumeiko/following{/other_user}","gists_url":"https://api.github.com/users/nkumeiko/gists{/gist_id}","starred_url":"https://api.github.com/users/nkumeiko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nkumeiko/subscriptions","organizations_url":"https://api.github.com/users/nkumeiko/orgs","repos_url":"https://api.github.com/users/nkumeiko/repos","events_url":"https://api.github.com/users/nkumeiko/events{/privacy}","received_events_url":"https://api.github.com/users/nkumeiko/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-01-05T09:21:31Z","updated_at":"2016-01-05T11:24:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b14802ba3c7db3bbb531fd28bca948314fc8e339","assignee":{"login":"momelnyk","id":655701,"avatar_url":"https://avatars.githubusercontent.com/u/655701?v=3","gravatar_id":"","url":"https://api.github.com/users/momelnyk","html_url":"https://github.com/momelnyk","followers_url":"https://api.github.com/users/momelnyk/followers","following_url":"https://api.github.com/users/momelnyk/following{/other_user}","gists_url":"https://api.github.com/users/momelnyk/gists{/gist_id}","starred_url":"https://api.github.com/users/momelnyk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/momelnyk/subscriptions","organizations_url":"https://api.github.com/users/momelnyk/orgs","repos_url":"https://api.github.com/users/momelnyk/repos","events_url":"https://api.github.com/users/momelnyk/events{/privacy}","received_events_url":"https://api.github.com/users/momelnyk/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/slate-studio/ants/pulls/6/commits","review_comments_url":"https://api.github.com/repos/slate-studio/ants/pulls/6/comments","review_comment_url":"https://api.github.com/repos/slate-studio/ants/pulls/comments{/number}","comments_url":"https://api.github.com/repos/slate-studio/ants/issues/6/comments","statuses_url":"https://api.github.com/repos/slate-studio/ants/statuses/580461499d1ac72476b42b35f9bdaa77ebed38fe","head":{"label":"slate-studio:feature/mm-rails-app","ref":"feature/mm-rails-app","sha":"580461499d1ac72476b42b35f9bdaa77ebed38fe","user":{"login":"slate-studio","id":689298,"avatar_url":"https://avatars.githubusercontent.com/u/689298?v=3","gravatar_id":"","url":"https://api.github.com/users/slate-studio","html_url":"https://github.com/slate-studio","followers_url":"https://api.github.com/users/slate-studio/followers","following_url":"https://api.github.com/users/slate-studio/following{/other_user}","gists_url":"https://api.github.com/users/slate-studio/gists{/gist_id}","starred_url":"https://api.github.com/users/slate-studio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slate-studio/subscriptions","organizations_url":"https://api.github.com/users/slate-studio/orgs","repos_url":"https://api.github.com/users/slate-studio/repos","events_url":"https://api.github.com/users/slate-studio/events{/privacy}","received_events_url":"https://api.github.com/users/slate-studio/received_events","type":"Organization","site_admin":false},"repo":{"id":34935263,"name":"ants","full_name":"slate-studio/ants","owner":{"login":"slate-studio","id":689298,"avatar_url":"https://avatars.githubusercontent.com/u/689298?v=3","gravatar_id":"","url":"https://api.github.com/users/slate-studio","html_url":"https://github.com/slate-studio","followers_url":"https://api.github.com/users/slate-studio/followers","following_url":"https://api.github.com/users/slate-studio/following{/other_user}","gists_url":"https://api.github.com/users/slate-studio/gists{/gist_id}","starred_url":"https://api.github.com/users/slate-studio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slate-studio/subscriptions","organizations_url":"https://api.github.com/users/slate-studio/orgs","repos_url":"https://api.github.com/users/slate-studio/repos","events_url":"https://api.github.com/users/slate-studio/events{/privacy}","received_events_url":"https://api.github.com/users/slate-studio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/slate-studio/ants","description":"Collection of concerns and helpers for Rails + Mongoid + Character web development","fork":false,"url":"https://api.github.com/repos/slate-studio/ants","forks_url":"https://api.github.com/repos/slate-studio/ants/forks","keys_url":"https://api.github.com/repos/slate-studio/ants/keys{/key_id}","collaborators_url":"https://api.github.com/repos/slate-studio/ants/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/slate-studio/ants/teams","hooks_url":"https://api.github.com/repos/slate-studio/ants/hooks","issue_events_url":"https://api.github.com/repos/slate-studio/ants/issues/events{/number}","events_url":"https://api.github.com/repos/slate-studio/ants/events","assignees_url":"https://api.github.com/repos/slate-studio/ants/assignees{/user}","branches_url":"https://api.github.com/repos/slate-studio/ants/branches{/branch}","tags_url":"https://api.github.com/repos/slate-studio/ants/tags","blobs_url":"https://api.github.com/repos/slate-studio/ants/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/slate-studio/ants/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/slate-studio/ants/git/refs{/sha}","trees_url":"https://api.github.com/repos/slate-studio/ants/git/trees{/sha}","statuses_url":"https://api.github.com/repos/slate-studio/ants/statuses/{sha}","languages_url":"https://api.github.com/repos/slate-studio/ants/languages","stargazers_url":"https://api.github.com/repos/slate-studio/ants/stargazers","contributors_url":"https://api.github.com/repos/slate-studio/ants/contributors","subscribers_url":"https://api.github.com/repos/slate-studio/ants/subscribers","subscription_url":"https://api.github.com/repos/slate-studio/ants/subscription","commits_url":"https://api.github.com/repos/slate-studio/ants/commits{/sha}","git_commits_url":"https://api.github.com/repos/slate-studio/ants/git/commits{/sha}","comments_url":"https://api.github.com/repos/slate-studio/ants/comments{/number}","issue_comment_url":"https://api.github.com/repos/slate-studio/ants/issues/comments{/number}","contents_url":"https://api.github.com/repos/slate-studio/ants/contents/{+path}","compare_url":"https://api.github.com/repos/slate-studio/ants/compare/{base}...{head}","merges_url":"https://api.github.com/repos/slate-studio/ants/merges","archive_url":"https://api.github.com/repos/slate-studio/ants/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/slate-studio/ants/downloads","issues_url":"https://api.github.com/repos/slate-studio/ants/issues{/number}","pulls_url":"https://api.github.com/repos/slate-studio/ants/pulls{/number}","milestones_url":"https://api.github.com/repos/slate-studio/ants/milestones{/number}","notifications_url":"https://api.github.com/repos/slate-studio/ants/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/slate-studio/ants/labels{/name}","releases_url":"https://api.github.com/repos/slate-studio/ants/releases{/id}","created_at":"2015-05-02T04:12:30Z","updated_at":"2015-10-06T11:12:34Z","pushed_at":"2016-01-05T11:24:09Z","git_url":"git://github.com/slate-studio/ants.git","ssh_url":"git@github.com:slate-studio/ants.git","clone_url":"https://github.com/slate-studio/ants.git","svn_url":"https://github.com/slate-studio/ants","homepage":"","size":129,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"slate-studio:master","ref":"master","sha":"e2971ebc4ff6c00c90e1ff9dc98b2a3aecb7c6ec","user":{"login":"slate-studio","id":689298,"avatar_url":"https://avatars.githubusercontent.com/u/689298?v=3","gravatar_id":"","url":"https://api.github.com/users/slate-studio","html_url":"https://github.com/slate-studio","followers_url":"https://api.github.com/users/slate-studio/followers","following_url":"https://api.github.com/users/slate-studio/following{/other_user}","gists_url":"https://api.github.com/users/slate-studio/gists{/gist_id}","starred_url":"https://api.github.com/users/slate-studio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slate-studio/subscriptions","organizations_url":"https://api.github.com/users/slate-studio/orgs","repos_url":"https://api.github.com/users/slate-studio/repos","events_url":"https://api.github.com/users/slate-studio/events{/privacy}","received_events_url":"https://api.github.com/users/slate-studio/received_events","type":"Organization","site_admin":false},"repo":{"id":34935263,"name":"ants","full_name":"slate-studio/ants","owner":{"login":"slate-studio","id":689298,"avatar_url":"https://avatars.githubusercontent.com/u/689298?v=3","gravatar_id":"","url":"https://api.github.com/users/slate-studio","html_url":"https://github.com/slate-studio","followers_url":"https://api.github.com/users/slate-studio/followers","following_url":"https://api.github.com/users/slate-studio/following{/other_user}","gists_url":"https://api.github.com/users/slate-studio/gists{/gist_id}","starred_url":"https://api.github.com/users/slate-studio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slate-studio/subscriptions","organizations_url":"https://api.github.com/users/slate-studio/orgs","repos_url":"https://api.github.com/users/slate-studio/repos","events_url":"https://api.github.com/users/slate-studio/events{/privacy}","received_events_url":"https://api.github.com/users/slate-studio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/slate-studio/ants","description":"Collection of concerns and helpers for Rails + Mongoid + Character web development","fork":false,"url":"https://api.github.com/repos/slate-studio/ants","forks_url":"https://api.github.com/repos/slate-studio/ants/forks","keys_url":"https://api.github.com/repos/slate-studio/ants/keys{/key_id}","collaborators_url":"https://api.github.com/repos/slate-studio/ants/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/slate-studio/ants/teams","hooks_url":"https://api.github.com/repos/slate-studio/ants/hooks","issue_events_url":"https://api.github.com/repos/slate-studio/ants/issues/events{/number}","events_url":"https://api.github.com/repos/slate-studio/ants/events","assignees_url":"https://api.github.com/repos/slate-studio/ants/assignees{/user}","branches_url":"https://api.github.com/repos/slate-studio/ants/branches{/branch}","tags_url":"https://api.github.com/repos/slate-studio/ants/tags","blobs_url":"https://api.github.com/repos/slate-studio/ants/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/slate-studio/ants/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/slate-studio/ants/git/refs{/sha}","trees_url":"https://api.github.com/repos/slate-studio/ants/git/trees{/sha}","statuses_url":"https://api.github.com/repos/slate-studio/ants/statuses/{sha}","languages_url":"https://api.github.com/repos/slate-studio/ants/languages","stargazers_url":"https://api.github.com/repos/slate-studio/ants/stargazers","contributors_url":"https://api.github.com/repos/slate-studio/ants/contributors","subscribers_url":"https://api.github.com/repos/slate-studio/ants/subscribers","subscription_url":"https://api.github.com/repos/slate-studio/ants/subscription","commits_url":"https://api.github.com/repos/slate-studio/ants/commits{/sha}","git_commits_url":"https://api.github.com/repos/slate-studio/ants/git/commits{/sha}","comments_url":"https://api.github.com/repos/slate-studio/ants/comments{/number}","issue_comment_url":"https://api.github.com/repos/slate-studio/ants/issues/comments{/number}","contents_url":"https://api.github.com/repos/slate-studio/ants/contents/{+path}","compare_url":"https://api.github.com/repos/slate-studio/ants/compare/{base}...{head}","merges_url":"https://api.github.com/repos/slate-studio/ants/merges","archive_url":"https://api.github.com/repos/slate-studio/ants/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/slate-studio/ants/downloads","issues_url":"https://api.github.com/repos/slate-studio/ants/issues{/number}","pulls_url":"https://api.github.com/repos/slate-studio/ants/pulls{/number}","milestones_url":"https://api.github.com/repos/slate-studio/ants/milestones{/number}","notifications_url":"https://api.github.com/repos/slate-studio/ants/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/slate-studio/ants/labels{/name}","releases_url":"https://api.github.com/repos/slate-studio/ants/releases{/id}","created_at":"2015-05-02T04:12:30Z","updated_at":"2015-10-06T11:12:34Z","pushed_at":"2016-01-05T11:24:09Z","git_url":"git://github.com/slate-studio/ants.git","ssh_url":"git@github.com:slate-studio/ants.git","clone_url":"https://github.com/slate-studio/ants.git","svn_url":"https://github.com/slate-studio/ants","homepage":"","size":129,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/slate-studio/ants/pulls/6"},"html":{"href":"https://github.com/slate-studio/ants/pull/6"},"issue":{"href":"https://api.github.com/repos/slate-studio/ants/issues/6"},"comments":{"href":"https://api.github.com/repos/slate-studio/ants/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/slate-studio/ants/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/slate-studio/ants/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/slate-studio/ants/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/slate-studio/ants/statuses/580461499d1ac72476b42b35f9bdaa77ebed38fe"}}}}