[Bug] page_entries_info does not work any more with Rails 6.1.3
johannesluedke opened this issue · 6 comments
Versions used:
- rails 6.1.3
- will_paginate (3.3.0)
The code = page_entries_info(@users)
in index.html.haml shows
Displaying all 18 #<Proc:0x00007f8d7751bce0 /path/to/ruby-install/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/will_paginate-3.3.0/lib/will_paginate/view_helpers.rb:126>
in the view.
In Rails 6.0 (rails (6.0.3.5) to be precise) this still showed correctly "Users".
see #618
@dacloutier-logmein
The error message from #618 says something different, so I wasn't sure if that fix would fix the problem I describe here as well.
Are there any updates to this?
I can still reproduce the problem with Rails 6.1.3.1 and Ruby 3.0.1
Same here. (Rails 6.1.3 and Will Paginate 3.3.0). I was able to work around it by using I18n, as follows:
page_entries_info @users, model: User
And in en.yml
:
will_paginate:
user:
page_entries_info:
single_page:
zero: "No users found"
one: "Displaying 1 user"
other: "Displaying all %{count} users"
single_page_html:
zero: "No users found"
one: "Displaying <b>1</b> user"
other: "Displaying <b>all %{count}</b> users"
multi_page: "Displaying users %{from} - %{to} of %{count} in total"
multi_page_html: "Displaying users <b>%{from} - %{to}</b> of <b>%{count}</b> in total"
I had to hardcode {model}
(with user
and users
) otherwise it would keep showing #<Proc:0x00007f8d7751bce0
. Since I'm already under will_paginate -> user
I don't think it's that bad to manually change it.