diff --git a/.ruby-version b/.ruby-version index 77fee73..0d3ad67 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -1.9.3 +2.2.10 diff --git a/lib/rocket_pants/controller/respondable.rb b/lib/rocket_pants/controller/respondable.rb index 6b6476e..6251c06 100644 --- a/lib/rocket_pants/controller/respondable.rb +++ b/lib/rocket_pants/controller/respondable.rb @@ -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 @@ -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), @@ -227,4 +227,4 @@ def metadata_for(object, options, type, singular) end end -end \ No newline at end of file +end