{"action":"created","comment":{"url":"https://api.github.com/repos/mdsol/pagem/pulls/comments/39423848","id":39423848,"diff_hunk":"@@ -6,38 +6,41 @@ class Pagem\n \n   ITEMS_PER_PAGE = 10\n \n+  attr_reader :scope, :items_per_page, :count\n+\n   def initialize(scope, params, opt = {})\n     @page_variable = opt[:page_variable] || :page\n     @count = opt[:count_number] || scope.count\n     @scope = scope\n     @params = params\n     @items_per_page = opt[:items_per_page] || ITEMS_PER_PAGE\n+    # This param should be an array of column names\n+    @order = opt[:order]\n   end\n \n   def icon_link(icon, text, url, options = {})\n     options = options.merge(\n       class: \"#{options[:class] if options[:class]} iconlink\",\n-      style: \"background-image:url(\" + (options[:global_url] ? icon.to_s : \"/images/medidata_buttons/#{icon}.gif\") + \")\",\n+      style: \"background-image:url(#{options[:global_url] ? icon.to_s : \"/images/medidata_buttons/#{icon}.gif\"})\",\n       global_url: nil\n      )\n     link_to text, url, options\n   end\n \n-  def scope\n-    @scope\n-  end\n-\n   # Returns a scope for the currently selected page, or an empty scope if current_page is not valid.\n   def paged_scope\n     (current_page > 0) ? scope.limit(items_per_page).offset((current_page - 1) * items_per_page) : scope.where('0=1')\n   end\n \n-  def items_per_page\n-    @items_per_page\n-  end\n+  # Returns an array of hashes containing the requested records. Used when pulling records from multiple tables.\n+  def paged_union_results","path":"lib/pagem.rb","position":39,"original_position":39,"commit_id":"479d0e8ccbb8dfa7d4d5516909ff414d48b4e88c","original_commit_id":"479d0e8ccbb8dfa7d4d5516909ff414d48b4e88c","user":{"login":"sllewelyn-mdsol","id":6089191,"avatar_url":"https://avatars.githubusercontent.com/u/6089191?v=3","gravatar_id":"","url":"https://api.github.com/users/sllewelyn-mdsol","html_url":"https://github.com/sllewelyn-mdsol","followers_url":"https://api.github.com/users/sllewelyn-mdsol/followers","following_url":"https://api.github.com/users/sllewelyn-mdsol/following{/other_user}","gists_url":"https://api.github.com/users/sllewelyn-mdsol/gists{/gist_id}","starred_url":"https://api.github.com/users/sllewelyn-mdsol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sllewelyn-mdsol/subscriptions","organizations_url":"https://api.github.com/users/sllewelyn-mdsol/orgs","repos_url":"https://api.github.com/users/sllewelyn-mdsol/repos","events_url":"https://api.github.com/users/sllewelyn-mdsol/events{/privacy}","received_events_url":"https://api.github.com/users/sllewelyn-mdsol/received_events","type":"User","site_admin":false},"body":"Is there some way we can do this without the pager gem having knowledge of the db?","created_at":"2015-09-14T17:48:47Z","updated_at":"2015-09-14T17:48:47Z","html_url":"https://github.com/mdsol/pagem/pull/3#discussion_r39423848","pull_request_url":"https://api.github.com/repos/mdsol/pagem/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/mdsol/pagem/pulls/comments/39423848"},"html":{"href":"https://github.com/mdsol/pagem/pull/3#discussion_r39423848"},"pull_request":{"href":"https://api.github.com/repos/mdsol/pagem/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/mdsol/pagem/pulls/3","id":44956634,"html_url":"https://github.com/mdsol/pagem/pull/3","diff_url":"https://github.com/mdsol/pagem/pull/3.diff","patch_url":"https://github.com/mdsol/pagem/pull/3.patch","issue_url":"https://api.github.com/repos/mdsol/pagem/issues/3","number":3,"state":"open","locked":false,"title":"Adding union pagination","user":{"login":"lwiyninger-mdsol","id":9041040,"avatar_url":"https://avatars.githubusercontent.com/u/9041040?v=3","gravatar_id":"","url":"https://api.github.com/users/lwiyninger-mdsol","html_url":"https://github.com/lwiyninger-mdsol","followers_url":"https://api.github.com/users/lwiyninger-mdsol/followers","following_url":"https://api.github.com/users/lwiyninger-mdsol/following{/other_user}","gists_url":"https://api.github.com/users/lwiyninger-mdsol/gists{/gist_id}","starred_url":"https://api.github.com/users/lwiyninger-mdsol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lwiyninger-mdsol/subscriptions","organizations_url":"https://api.github.com/users/lwiyninger-mdsol/orgs","repos_url":"https://api.github.com/users/lwiyninger-mdsol/repos","events_url":"https://api.github.com/users/lwiyninger-mdsol/events{/privacy}","received_events_url":"https://api.github.com/users/lwiyninger-mdsol/received_events","type":"User","site_admin":false},"body":"# Feature\r\n\r\nWe needed a way to create a paginated table with scopes from different models, so I'm proposing a modification to this gem to return an array of items when multiple scopes are passed in. \r\n\r\n# Screenshots\r\n\r\nN/A\r\n\r\n# Tests\r\n\r\nbundle exec rspec spec\r\n```\r\nFinished in 0.25282 seconds\r\n25 examples, 0 failures\r\n```","created_at":"2015-09-14T17:21:04Z","updated_at":"2015-09-14T17:48:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b2b91b5cfaa98d5ebcb8316edd58bdba69449f2a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mdsol/pagem/pulls/3/commits","review_comments_url":"https://api.github.com/repos/mdsol/pagem/pulls/3/comments","review_comment_url":"https://api.github.com/repos/mdsol/pagem/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mdsol/pagem/issues/3/comments","statuses_url":"https://api.github.com/repos/mdsol/pagem/statuses/479d0e8ccbb8dfa7d4d5516909ff414d48b4e88c","head":{"label":"mdsol:add_union_scopes","ref":"add_union_scopes","sha":"479d0e8ccbb8dfa7d4d5516909ff414d48b4e88c","user":{"login":"mdsol","id":171103,"avatar_url":"https://avatars.githubusercontent.com/u/171103?v=3","gravatar_id":"","url":"https://api.github.com/users/mdsol","html_url":"https://github.com/mdsol","followers_url":"https://api.github.com/users/mdsol/followers","following_url":"https://api.github.com/users/mdsol/following{/other_user}","gists_url":"https://api.github.com/users/mdsol/gists{/gist_id}","starred_url":"https://api.github.com/users/mdsol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdsol/subscriptions","organizations_url":"https://api.github.com/users/mdsol/orgs","repos_url":"https://api.github.com/users/mdsol/repos","events_url":"https://api.github.com/users/mdsol/events{/privacy}","received_events_url":"https://api.github.com/users/mdsol/received_events","type":"Organization","site_admin":false},"repo":{"id":803773,"name":"pagem","full_name":"mdsol/pagem","owner":{"login":"mdsol","id":171103,"avatar_url":"https://avatars.githubusercontent.com/u/171103?v=3","gravatar_id":"","url":"https://api.github.com/users/mdsol","html_url":"https://github.com/mdsol","followers_url":"https://api.github.com/users/mdsol/followers","following_url":"https://api.github.com/users/mdsol/following{/other_user}","gists_url":"https://api.github.com/users/mdsol/gists{/gist_id}","starred_url":"https://api.github.com/users/mdsol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdsol/subscriptions","organizations_url":"https://api.github.com/users/mdsol/orgs","repos_url":"https://api.github.com/users/mdsol/repos","events_url":"https://api.github.com/users/mdsol/events{/privacy}","received_events_url":"https://api.github.com/users/mdsol/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mdsol/pagem","description":"Pagination library for Mdsol Rails applications","fork":false,"url":"https://api.github.com/repos/mdsol/pagem","forks_url":"https://api.github.com/repos/mdsol/pagem/forks","keys_url":"https://api.github.com/repos/mdsol/pagem/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mdsol/pagem/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mdsol/pagem/teams","hooks_url":"https://api.github.com/repos/mdsol/pagem/hooks","issue_events_url":"https://api.github.com/repos/mdsol/pagem/issues/events{/number}","events_url":"https://api.github.com/repos/mdsol/pagem/events","assignees_url":"https://api.github.com/repos/mdsol/pagem/assignees{/user}","branches_url":"https://api.github.com/repos/mdsol/pagem/branches{/branch}","tags_url":"https://api.github.com/repos/mdsol/pagem/tags","blobs_url":"https://api.github.com/repos/mdsol/pagem/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mdsol/pagem/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mdsol/pagem/git/refs{/sha}","trees_url":"https://api.github.com/repos/mdsol/pagem/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mdsol/pagem/statuses/{sha}","languages_url":"https://api.github.com/repos/mdsol/pagem/languages","stargazers_url":"https://api.github.com/repos/mdsol/pagem/stargazers","contributors_url":"https://api.github.com/repos/mdsol/pagem/contributors","subscribers_url":"https://api.github.com/repos/mdsol/pagem/subscribers","subscription_url":"https://api.github.com/repos/mdsol/pagem/subscription","commits_url":"https://api.github.com/repos/mdsol/pagem/commits{/sha}","git_commits_url":"https://api.github.com/repos/mdsol/pagem/git/commits{/sha}","comments_url":"https://api.github.com/repos/mdsol/pagem/comments{/number}","issue_comment_url":"https://api.github.com/repos/mdsol/pagem/issues/comments{/number}","contents_url":"https://api.github.com/repos/mdsol/pagem/contents/{+path}","compare_url":"https://api.github.com/repos/mdsol/pagem/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mdsol/pagem/merges","archive_url":"https://api.github.com/repos/mdsol/pagem/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mdsol/pagem/downloads","issues_url":"https://api.github.com/repos/mdsol/pagem/issues{/number}","pulls_url":"https://api.github.com/repos/mdsol/pagem/pulls{/number}","milestones_url":"https://api.github.com/repos/mdsol/pagem/milestones{/number}","notifications_url":"https://api.github.com/repos/mdsol/pagem/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mdsol/pagem/labels{/name}","releases_url":"https://api.github.com/repos/mdsol/pagem/releases{/id}","created_at":"2010-07-28T20:43:13Z","updated_at":"2015-01-12T22:33:58Z","pushed_at":"2015-09-14T17:21:04Z","git_url":"git://github.com/mdsol/pagem.git","ssh_url":"git@github.com:mdsol/pagem.git","clone_url":"https://github.com/mdsol/pagem.git","svn_url":"https://github.com/mdsol/pagem","homepage":"","size":203,"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":"mdsol:master","ref":"master","sha":"3167fca5fd522e56fdf2186937fa63bd289738f6","user":{"login":"mdsol","id":171103,"avatar_url":"https://avatars.githubusercontent.com/u/171103?v=3","gravatar_id":"","url":"https://api.github.com/users/mdsol","html_url":"https://github.com/mdsol","followers_url":"https://api.github.com/users/mdsol/followers","following_url":"https://api.github.com/users/mdsol/following{/other_user}","gists_url":"https://api.github.com/users/mdsol/gists{/gist_id}","starred_url":"https://api.github.com/users/mdsol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdsol/subscriptions","organizations_url":"https://api.github.com/users/mdsol/orgs","repos_url":"https://api.github.com/users/mdsol/repos","events_url":"https://api.github.com/users/mdsol/events{/privacy}","received_events_url":"https://api.github.com/users/mdsol/received_events","type":"Organization","site_admin":false},"repo":{"id":803773,"name":"pagem","full_name":"mdsol/pagem","owner":{"login":"mdsol","id":171103,"avatar_url":"https://avatars.githubusercontent.com/u/171103?v=3","gravatar_id":"","url":"https://api.github.com/users/mdsol","html_url":"https://github.com/mdsol","followers_url":"https://api.github.com/users/mdsol/followers","following_url":"https://api.github.com/users/mdsol/following{/other_user}","gists_url":"https://api.github.com/users/mdsol/gists{/gist_id}","starred_url":"https://api.github.com/users/mdsol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdsol/subscriptions","organizations_url":"https://api.github.com/users/mdsol/orgs","repos_url":"https://api.github.com/users/mdsol/repos","events_url":"https://api.github.com/users/mdsol/events{/privacy}","received_events_url":"https://api.github.com/users/mdsol/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mdsol/pagem","description":"Pagination library for Mdsol Rails applications","fork":false,"url":"https://api.github.com/repos/mdsol/pagem","forks_url":"https://api.github.com/repos/mdsol/pagem/forks","keys_url":"https://api.github.com/repos/mdsol/pagem/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mdsol/pagem/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mdsol/pagem/teams","hooks_url":"https://api.github.com/repos/mdsol/pagem/hooks","issue_events_url":"https://api.github.com/repos/mdsol/pagem/issues/events{/number}","events_url":"https://api.github.com/repos/mdsol/pagem/events","assignees_url":"https://api.github.com/repos/mdsol/pagem/assignees{/user}","branches_url":"https://api.github.com/repos/mdsol/pagem/branches{/branch}","tags_url":"https://api.github.com/repos/mdsol/pagem/tags","blobs_url":"https://api.github.com/repos/mdsol/pagem/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mdsol/pagem/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mdsol/pagem/git/refs{/sha}","trees_url":"https://api.github.com/repos/mdsol/pagem/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mdsol/pagem/statuses/{sha}","languages_url":"https://api.github.com/repos/mdsol/pagem/languages","stargazers_url":"https://api.github.com/repos/mdsol/pagem/stargazers","contributors_url":"https://api.github.com/repos/mdsol/pagem/contributors","subscribers_url":"https://api.github.com/repos/mdsol/pagem/subscribers","subscription_url":"https://api.github.com/repos/mdsol/pagem/subscription","commits_url":"https://api.github.com/repos/mdsol/pagem/commits{/sha}","git_commits_url":"https://api.github.com/repos/mdsol/pagem/git/commits{/sha}","comments_url":"https://api.github.com/repos/mdsol/pagem/comments{/number}","issue_comment_url":"https://api.github.com/repos/mdsol/pagem/issues/comments{/number}","contents_url":"https://api.github.com/repos/mdsol/pagem/contents/{+path}","compare_url":"https://api.github.com/repos/mdsol/pagem/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mdsol/pagem/merges","archive_url":"https://api.github.com/repos/mdsol/pagem/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mdsol/pagem/downloads","issues_url":"https://api.github.com/repos/mdsol/pagem/issues{/number}","pulls_url":"https://api.github.com/repos/mdsol/pagem/pulls{/number}","milestones_url":"https://api.github.com/repos/mdsol/pagem/milestones{/number}","notifications_url":"https://api.github.com/repos/mdsol/pagem/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mdsol/pagem/labels{/name}","releases_url":"https://api.github.com/repos/mdsol/pagem/releases{/id}","created_at":"2010-07-28T20:43:13Z","updated_at":"2015-01-12T22:33:58Z","pushed_at":"2015-09-14T17:21:04Z","git_url":"git://github.com/mdsol/pagem.git","ssh_url":"git@github.com:mdsol/pagem.git","clone_url":"https://github.com/mdsol/pagem.git","svn_url":"https://github.com/mdsol/pagem","homepage":"","size":203,"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/mdsol/pagem/pulls/3"},"html":{"href":"https://github.com/mdsol/pagem/pull/3"},"issue":{"href":"https://api.github.com/repos/mdsol/pagem/issues/3"},"comments":{"href":"https://api.github.com/repos/mdsol/pagem/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/mdsol/pagem/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/mdsol/pagem/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mdsol/pagem/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/mdsol/pagem/statuses/479d0e8ccbb8dfa7d4d5516909ff414d48b4e88c"}}}}