Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added support for modern kaminari #152

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.9.3
2.2.10
6 changes: 3 additions & 3 deletions lib/rocket_pants/controller/respondable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def serializable_hash(options = {})
def self.pagination_type(object)
if object.respond_to?(:total_entries)
:will_paginate
elsif object.respond_to?(:num_pages) && object.respond_to?(:current_page)
elsif object.respond_to?(:total_pages) && object.respond_to?(:current_page)
:kaminari
else
nil
Expand Down Expand Up @@ -49,7 +49,7 @@ def self.extract_pagination(collection)
:pages => collection.total_pages.try(:to_i)
}
when :kaminari
current, total, per_page = collection.current_page, collection.num_pages, collection.limit_value
current, total, per_page = collection.current_page, collection.total_pages, collection.limit_value
{
:current => current,
:previous => (current > 1 ? (current - 1) : nil),
Expand Down Expand Up @@ -227,4 +227,4 @@ def metadata_for(object, options, type, singular)
end

end
end
end