diff --git a/kaminari-activerecord/lib/kaminari/activerecord/active_record_relation_methods.rb b/kaminari-activerecord/lib/kaminari/activerecord/active_record_relation_methods.rb index ee0c2fa..0c3a0e9 100644 --- a/kaminari-activerecord/lib/kaminari/activerecord/active_record_relation_methods.rb +++ b/kaminari-activerecord/lib/kaminari/activerecord/active_record_relation_methods.rb @@ -20,7 +20,7 @@ module Kaminari if loaded? # Total count has to be 0 if loaded records are 0 return @total_count = 0 if (current_page == 1) && @records.empty? - # Total count is calculatable at the last page + # Total count is calculable at the last page per_page = (defined?(@_per) && @_per) || default_per_page return @total_count = (current_page - 1) * per_page + @records.length if @records.any? && (@records.length < per_page) end