{"action":"created","comment":{"url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/comments/56372822","id":56372822,"diff_hunk":"@@ -2,47 +2,34 @@\n \n # How to add pagination links\n \n-### JSON API adapter\n+## JSON API adapter\n \n-Pagination links will be included in your response automatically as long as\n-the resource is paginated and if you are using the ```JsonApi``` adapter.\n+When using the `JsonApi` adapter, pagination links will be automatically included if you use [Kaminari](https://github.com/amatsuda/kaminari)\n+or [WillPaginate](https://github.com/mislav/will_paginate) within a Rails controller:\n \n-If you want pagination links in your response, use [Kaminari](https://github.com/amatsuda/kaminari)\n-or [WillPaginate](https://github.com/mislav/will_paginate).\n-\n-Although the others adapters does not have this feature, it is possible to\n-implement pagination links to `JSON` adapter. For more information about it,\n-please see in our docs \n-\n-###### Kaminari examples\n+* Using Kaminari:\n \n ```ruby\n-#array\n-@posts = Kaminari.paginate_array([1, 2, 3]).page(3).per(1)\n-render json: @posts\n-\n-#active_record\n-@posts = Post.page(3).per(1)\n-render json: @posts\n+class PostsController < ApplicationController\n+  def index\n+    posts = Post.page(page).per(per_page)\n+    render json: posts\n+  end\n+end\n ```\n \n-###### WillPaginate examples\n-\n-```ruby\n-#array\n-@posts = [1,2,3].paginate(page: 3, per_page: 1)\n-render json: @posts\n-\n-#active_record\n-@posts = Post.page(3).per_page(1)\n-render json: @posts\n-```\n+* Using WillPaginate:\n \n ```ruby\n-ActiveModelSerializers.config.adapter = :json_api\n+class PostsController < ApplicationController\n+  def index\n+    posts = Post.page(page).per_page(per_page)","path":"docs/howto/add_pagination_links.md","position":55,"original_position":55,"commit_id":"5e5152bc1d0a5b7fccfb007a3f1fe847c59094ce","original_commit_id":"5e5152bc1d0a5b7fccfb007a3f1fe847c59094ce","user":{"login":"NullVoxPopuli","id":199018,"avatar_url":"https://avatars.githubusercontent.com/u/199018?v=3","gravatar_id":"","url":"https://api.github.com/users/NullVoxPopuli","html_url":"https://github.com/NullVoxPopuli","followers_url":"https://api.github.com/users/NullVoxPopuli/followers","following_url":"https://api.github.com/users/NullVoxPopuli/following{/other_user}","gists_url":"https://api.github.com/users/NullVoxPopuli/gists{/gist_id}","starred_url":"https://api.github.com/users/NullVoxPopuli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NullVoxPopuli/subscriptions","organizations_url":"https://api.github.com/users/NullVoxPopuli/orgs","repos_url":"https://api.github.com/users/NullVoxPopuli/repos","events_url":"https://api.github.com/users/NullVoxPopuli/events{/privacy}","received_events_url":"https://api.github.com/users/NullVoxPopuli/received_events","type":"User","site_admin":false},"body":"where do page and per_page come from?","created_at":"2016-03-16T17:02:56Z","updated_at":"2016-03-16T17:02:56Z","html_url":"https://github.com/rails-api/active_model_serializers/pull/1596#discussion_r56372822","pull_request_url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1596","_links":{"self":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/comments/56372822"},"html":{"href":"https://github.com/rails-api/active_model_serializers/pull/1596#discussion_r56372822"},"pull_request":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1596"}}},"pull_request":{"url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1596","id":63099275,"html_url":"https://github.com/rails-api/active_model_serializers/pull/1596","diff_url":"https://github.com/rails-api/active_model_serializers/pull/1596.diff","patch_url":"https://github.com/rails-api/active_model_serializers/pull/1596.patch","issue_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1596","number":1596,"state":"open","locked":false,"title":"Add a way to disable JsonApi automatic pagination","user":{"login":"groyoh","id":7434196,"avatar_url":"https://avatars.githubusercontent.com/u/7434196?v=3","gravatar_id":"","url":"https://api.github.com/users/groyoh","html_url":"https://github.com/groyoh","followers_url":"https://api.github.com/users/groyoh/followers","following_url":"https://api.github.com/users/groyoh/following{/other_user}","gists_url":"https://api.github.com/users/groyoh/gists{/gist_id}","starred_url":"https://api.github.com/users/groyoh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/groyoh/subscriptions","organizations_url":"https://api.github.com/users/groyoh/orgs","repos_url":"https://api.github.com/users/groyoh/repos","events_url":"https://api.github.com/users/groyoh/events{/privacy}","received_events_url":"https://api.github.com/users/groyoh/received_events","type":"User","site_admin":false},"body":"#### Purpose\r\nProvides a way to prevent automatic links rendering when using kaminari or will_paginate. See #1549 and https://github.com/rails-api/active_model_serializers/issues/1549#issuecomment-191568335.\r\n\r\n#### Changes\r\nAdded a `NonPaginatedCollectionSerializer` with tests and documentation for it. \r\n\r\n#### Related GitHub issues\r\nSolves #1549 ","created_at":"2016-03-16T16:57:47Z","updated_at":"2016-03-16T17:02:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"431ae18549246317ef20a03bf03b707936156bac","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1596/commits","review_comments_url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1596/comments","review_comment_url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1596/comments","statuses_url":"https://api.github.com/repos/rails-api/active_model_serializers/statuses/5e5152bc1d0a5b7fccfb007a3f1fe847c59094ce","head":{"label":"groyoh:auto_paginate","ref":"auto_paginate","sha":"5e5152bc1d0a5b7fccfb007a3f1fe847c59094ce","user":{"login":"groyoh","id":7434196,"avatar_url":"https://avatars.githubusercontent.com/u/7434196?v=3","gravatar_id":"","url":"https://api.github.com/users/groyoh","html_url":"https://github.com/groyoh","followers_url":"https://api.github.com/users/groyoh/followers","following_url":"https://api.github.com/users/groyoh/following{/other_user}","gists_url":"https://api.github.com/users/groyoh/gists{/gist_id}","starred_url":"https://api.github.com/users/groyoh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/groyoh/subscriptions","organizations_url":"https://api.github.com/users/groyoh/orgs","repos_url":"https://api.github.com/users/groyoh/repos","events_url":"https://api.github.com/users/groyoh/events{/privacy}","received_events_url":"https://api.github.com/users/groyoh/received_events","type":"User","site_admin":false},"repo":{"id":33311083,"name":"active_model_serializers","full_name":"groyoh/active_model_serializers","owner":{"login":"groyoh","id":7434196,"avatar_url":"https://avatars.githubusercontent.com/u/7434196?v=3","gravatar_id":"","url":"https://api.github.com/users/groyoh","html_url":"https://github.com/groyoh","followers_url":"https://api.github.com/users/groyoh/followers","following_url":"https://api.github.com/users/groyoh/following{/other_user}","gists_url":"https://api.github.com/users/groyoh/gists{/gist_id}","starred_url":"https://api.github.com/users/groyoh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/groyoh/subscriptions","organizations_url":"https://api.github.com/users/groyoh/orgs","repos_url":"https://api.github.com/users/groyoh/repos","events_url":"https://api.github.com/users/groyoh/events{/privacy}","received_events_url":"https://api.github.com/users/groyoh/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/groyoh/active_model_serializers","description":"ActiveModel::Serializer implementation and Rails hooks","fork":true,"url":"https://api.github.com/repos/groyoh/active_model_serializers","forks_url":"https://api.github.com/repos/groyoh/active_model_serializers/forks","keys_url":"https://api.github.com/repos/groyoh/active_model_serializers/keys{/key_id}","collaborators_url":"https://api.github.com/repos/groyoh/active_model_serializers/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/groyoh/active_model_serializers/teams","hooks_url":"https://api.github.com/repos/groyoh/active_model_serializers/hooks","issue_events_url":"https://api.github.com/repos/groyoh/active_model_serializers/issues/events{/number}","events_url":"https://api.github.com/repos/groyoh/active_model_serializers/events","assignees_url":"https://api.github.com/repos/groyoh/active_model_serializers/assignees{/user}","branches_url":"https://api.github.com/repos/groyoh/active_model_serializers/branches{/branch}","tags_url":"https://api.github.com/repos/groyoh/active_model_serializers/tags","blobs_url":"https://api.github.com/repos/groyoh/active_model_serializers/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/groyoh/active_model_serializers/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/groyoh/active_model_serializers/git/refs{/sha}","trees_url":"https://api.github.com/repos/groyoh/active_model_serializers/git/trees{/sha}","statuses_url":"https://api.github.com/repos/groyoh/active_model_serializers/statuses/{sha}","languages_url":"https://api.github.com/repos/groyoh/active_model_serializers/languages","stargazers_url":"https://api.github.com/repos/groyoh/active_model_serializers/stargazers","contributors_url":"https://api.github.com/repos/groyoh/active_model_serializers/contributors","subscribers_url":"https://api.github.com/repos/groyoh/active_model_serializers/subscribers","subscription_url":"https://api.github.com/repos/groyoh/active_model_serializers/subscription","commits_url":"https://api.github.com/repos/groyoh/active_model_serializers/commits{/sha}","git_commits_url":"https://api.github.com/repos/groyoh/active_model_serializers/git/commits{/sha}","comments_url":"https://api.github.com/repos/groyoh/active_model_serializers/comments{/number}","issue_comment_url":"https://api.github.com/repos/groyoh/active_model_serializers/issues/comments{/number}","contents_url":"https://api.github.com/repos/groyoh/active_model_serializers/contents/{+path}","compare_url":"https://api.github.com/repos/groyoh/active_model_serializers/compare/{base}...{head}","merges_url":"https://api.github.com/repos/groyoh/active_model_serializers/merges","archive_url":"https://api.github.com/repos/groyoh/active_model_serializers/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/groyoh/active_model_serializers/downloads","issues_url":"https://api.github.com/repos/groyoh/active_model_serializers/issues{/number}","pulls_url":"https://api.github.com/repos/groyoh/active_model_serializers/pulls{/number}","milestones_url":"https://api.github.com/repos/groyoh/active_model_serializers/milestones{/number}","notifications_url":"https://api.github.com/repos/groyoh/active_model_serializers/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/groyoh/active_model_serializers/labels{/name}","releases_url":"https://api.github.com/repos/groyoh/active_model_serializers/releases{/id}","deployments_url":"https://api.github.com/repos/groyoh/active_model_serializers/deployments","created_at":"2015-04-02T13:44:27Z","updated_at":"2016-02-19T08:45:58Z","pushed_at":"2016-03-16T16:55:20Z","git_url":"git://github.com/groyoh/active_model_serializers.git","ssh_url":"git@github.com:groyoh/active_model_serializers.git","clone_url":"https://github.com/groyoh/active_model_serializers.git","svn_url":"https://github.com/groyoh/active_model_serializers","homepage":"","size":2778,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"rails-api:master","ref":"master","sha":"db87f8d85e7a46ef195a555cb7e2509f1affc622","user":{"login":"rails-api","id":2820360,"avatar_url":"https://avatars.githubusercontent.com/u/2820360?v=3","gravatar_id":"","url":"https://api.github.com/users/rails-api","html_url":"https://github.com/rails-api","followers_url":"https://api.github.com/users/rails-api/followers","following_url":"https://api.github.com/users/rails-api/following{/other_user}","gists_url":"https://api.github.com/users/rails-api/gists{/gist_id}","starred_url":"https://api.github.com/users/rails-api/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rails-api/subscriptions","organizations_url":"https://api.github.com/users/rails-api/orgs","repos_url":"https://api.github.com/users/rails-api/repos","events_url":"https://api.github.com/users/rails-api/events{/privacy}","received_events_url":"https://api.github.com/users/rails-api/received_events","type":"Organization","site_admin":false},"repo":{"id":2889230,"name":"active_model_serializers","full_name":"rails-api/active_model_serializers","owner":{"login":"rails-api","id":2820360,"avatar_url":"https://avatars.githubusercontent.com/u/2820360?v=3","gravatar_id":"","url":"https://api.github.com/users/rails-api","html_url":"https://github.com/rails-api","followers_url":"https://api.github.com/users/rails-api/followers","following_url":"https://api.github.com/users/rails-api/following{/other_user}","gists_url":"https://api.github.com/users/rails-api/gists{/gist_id}","starred_url":"https://api.github.com/users/rails-api/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rails-api/subscriptions","organizations_url":"https://api.github.com/users/rails-api/orgs","repos_url":"https://api.github.com/users/rails-api/repos","events_url":"https://api.github.com/users/rails-api/events{/privacy}","received_events_url":"https://api.github.com/users/rails-api/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rails-api/active_model_serializers","description":"ActiveModel::Serializer implementation and Rails hooks","fork":false,"url":"https://api.github.com/repos/rails-api/active_model_serializers","forks_url":"https://api.github.com/repos/rails-api/active_model_serializers/forks","keys_url":"https://api.github.com/repos/rails-api/active_model_serializers/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rails-api/active_model_serializers/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rails-api/active_model_serializers/teams","hooks_url":"https://api.github.com/repos/rails-api/active_model_serializers/hooks","issue_events_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/events{/number}","events_url":"https://api.github.com/repos/rails-api/active_model_serializers/events","assignees_url":"https://api.github.com/repos/rails-api/active_model_serializers/assignees{/user}","branches_url":"https://api.github.com/repos/rails-api/active_model_serializers/branches{/branch}","tags_url":"https://api.github.com/repos/rails-api/active_model_serializers/tags","blobs_url":"https://api.github.com/repos/rails-api/active_model_serializers/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rails-api/active_model_serializers/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rails-api/active_model_serializers/git/refs{/sha}","trees_url":"https://api.github.com/repos/rails-api/active_model_serializers/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rails-api/active_model_serializers/statuses/{sha}","languages_url":"https://api.github.com/repos/rails-api/active_model_serializers/languages","stargazers_url":"https://api.github.com/repos/rails-api/active_model_serializers/stargazers","contributors_url":"https://api.github.com/repos/rails-api/active_model_serializers/contributors","subscribers_url":"https://api.github.com/repos/rails-api/active_model_serializers/subscribers","subscription_url":"https://api.github.com/repos/rails-api/active_model_serializers/subscription","commits_url":"https://api.github.com/repos/rails-api/active_model_serializers/commits{/sha}","git_commits_url":"https://api.github.com/repos/rails-api/active_model_serializers/git/commits{/sha}","comments_url":"https://api.github.com/repos/rails-api/active_model_serializers/comments{/number}","issue_comment_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/comments{/number}","contents_url":"https://api.github.com/repos/rails-api/active_model_serializers/contents/{+path}","compare_url":"https://api.github.com/repos/rails-api/active_model_serializers/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rails-api/active_model_serializers/merges","archive_url":"https://api.github.com/repos/rails-api/active_model_serializers/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rails-api/active_model_serializers/downloads","issues_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues{/number}","pulls_url":"https://api.github.com/repos/rails-api/active_model_serializers/pulls{/number}","milestones_url":"https://api.github.com/repos/rails-api/active_model_serializers/milestones{/number}","notifications_url":"https://api.github.com/repos/rails-api/active_model_serializers/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rails-api/active_model_serializers/labels{/name}","releases_url":"https://api.github.com/repos/rails-api/active_model_serializers/releases{/id}","deployments_url":"https://api.github.com/repos/rails-api/active_model_serializers/deployments","created_at":"2011-12-01T06:39:26Z","updated_at":"2016-03-15T16:32:59Z","pushed_at":"2016-03-16T16:57:48Z","git_url":"git://github.com/rails-api/active_model_serializers.git","ssh_url":"git@github.com:rails-api/active_model_serializers.git","clone_url":"https://github.com/rails-api/active_model_serializers.git","svn_url":"https://github.com/rails-api/active_model_serializers","homepage":"","size":4104,"stargazers_count":3380,"watchers_count":3380,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":837,"mirror_url":null,"open_issues_count":158,"forks":837,"open_issues":158,"watchers":3380,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1596"},"html":{"href":"https://github.com/rails-api/active_model_serializers/pull/1596"},"issue":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1596"},"comments":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1596/comments"},"review_comments":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1596/comments"},"review_comment":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/pulls/1596/commits"},"statuses":{"href":"https://api.github.com/repos/rails-api/active_model_serializers/statuses/5e5152bc1d0a5b7fccfb007a3f1fe847c59094ce"}}}}