lib/kaminari/helpers/action_view_extension.rb in kaminari-0.16.3 vs lib/kaminari/helpers/action_view_extension.rb in kaminari-0.17.0
- old
+ new
@@ -93,10 +93,10 @@
if collection.total_pages < 2
t('helpers.page_entries_info.one_page.display_entries', :entry_name => entry_name, :count => collection.total_count)
else
first = collection.offset_value + 1
- last = collection.last_page? ? collection.total_count : collection.offset_value + collection.limit_value
+ last = (sum = collection.offset_value + collection.limit_value) > collection.total_count ? collection.total_count : sum
t('helpers.page_entries_info.more_pages.display_entries', :entry_name => entry_name, :first => first, :last => last, :total => collection.total_count)
end.html_safe
end
# Renders rel="next" and rel="prev" links to be used in the head.