Closed kvokka closed 3 years ago
FWIW I made my own helper to fix this in Rails 6.1 till a fix gets a release:
def page_entries_info(collection)
model_name = collection.respond_to?(:human_name) ? collection.model_name.human : (collection.first&.model_name&.human || '')
sanitize "Displaying #{model_name} " +
tag.b("#{collection.offset + 1} - #{[collection.per_page * collection.current_page, collection.total_entries].min}") +
' of ' + tag.b(collection.total_entries) +
' in total'
end
@jonknapp thanks for sharing a simple solution. This won't work in many scenarios since it bypasses I18n and single/multi page handling. Another workaround would be to apply https://github.com/mislav/will_paginate/pull/619 locally in an initializer.
We actually just updated our Gemfile to use kvokka's patched branch while we watch for it to be merged. It seems to work fine.
Thank you for reporting! This bug is not in will_paginate, but due to a regression in Rails 6.1 translate
method, and will be fixed with Rails 6.1.2: https://github.com/rails/rails/pull/40691
It looks like it missed 6.1.2 and 6.1.3; still not merged.
It's now merged but we will have to wait until Rails 6.1.4.
Rails 6.1.4 has been released fixing this problem.
Using Rails 6.1.rc1, CRuby 2.5.8, will-paginate 3.3.0
backtrace: