will_paginate icon indicating copy to clipboard operation
will_paginate copied to clipboard

page_entries_info not accept model object with Rails 4.1.8

Open ldonnet opened this issue 11 years ago • 1 comments

Hi,

I use your great gem in my rails application and migrate from rails 3.1.13 to Rails 4.1.8 and encounter perhaps a bug.

I have a view which display companies :

<div id="companies">
  <%= render partial: "companies", object: @companies %>
</div>

and call a partial :

<div class="page_info">
  <span class="search"> <%= t("will_paginate.page_entries_info.search") %></span> <%= page_entries_info( @companies ) %>
</div>
<div class="companies paginated_content">
   <%= paginated_content(@companies) %>
</div>
<div class="pagination">
  <%= will_paginate @companies, :container => false, renderer: RemoteBootstrapPaginationLinkRenderer %>
</div>

And my code fails on "page_entries_info( @companies )" : ActionView::Template::Error : wrong number of arguments (1 for 0).

But when I do this trick "page_entries_info( @companies.to_a )" it works :

<div class="page_info">
  <span class="search"> <%= t("will_paginate.page_entries_info.search") %></span> <%= page_entries_info( @companies.to_a ) %>
</div>
<div class="companies paginated_content">
   <%= paginated_content(@companies) %>
</div>
<div class="pagination">
  <%= will_paginate @companies, :container => false, renderer: RemoteBootstrapPaginationLinkRenderer %>
</div>

Do i use a bad syntax or make a mistake somewhere?

Best Regards Luc Donnet

ldonnet avatar Jan 06 '15 10:01 ldonnet

Same problem for me after update Rails but for object with one page not more, working with .to_a Example: <%= page_entries_info @users.to_a, :model => 'users' %>

AlexandrBasan avatar Feb 17 '16 23:02 AlexandrBasan