Avoid duping the whole @records with .to_a call on recent versions of AR

This commit is contained in:
Akira Matsuda 2019-06-14 18:31:39 +09:00
parent 465e391bc9
commit 510b492e95
1 changed files with 1 additions and 1 deletions

View File

@ -204,7 +204,7 @@ module Kaminari
t('helpers.page_entries_info.one_page.display_entries', entry_name: entry_name, count: collection.total_count)
else
from = collection.offset_value + 1
to = collection.offset_value + collection.to_a.size
to = collection.offset_value + (collection.respond_to?(:records) ? collection.records : collection.to_a).size
t('helpers.page_entries_info.more_pages.display_entries', entry_name: entry_name, first: from, last: to, total: collection.total_count)
end.html_safe