Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lib/pager_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ module PagerApi
mattr_accessor :pagination_handler
@@pagination_handler = :kaminari

# page access method
mattr_accessor :page_access_method
@@page_access_method = :page

# per page access method
mattr_accessor :per_page_access_method
@@per_page_access_method = :per
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can rename this to per_page to match a default value for Kaminari and WillPaginate, how does that sound?


# Meta tag information for pagination
mattr_accessor :include_pagination_on_meta
@@include_pagination_on_meta = true
Expand All @@ -14,7 +22,7 @@ module PagerApi

# Total Pages Header name
mattr_accessor :total_pages_header
@@total_count_header = "X-Total-Pages"
@@total_pages_header = "X-Total-Pages"

# Total Count Header name
mattr_accessor :total_count_header
Expand Down
2 changes: 1 addition & 1 deletion lib/pager_api/pagination/kaminari.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def paginate_collection(collection, options = {})
options[:page] = params[:page] || 1
options[:per_page] = options.delete(:per_page) || params[:per_page] || ::Kaminari.config.default_per_page

collection.page(options[:page]).per(options[:per_page])
collection.send(PagerApi.page_access_method, options[:page]).send(PagerApi.per_page_access_method, options[:per_page])
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a meta which I think you can update to meet this two accessors, what do you think?

Also there can you provide the update for the will_paginate driver module to meet this as well?

Thanks for the collaboration!

end

def meta(collection, options = {})
Expand Down