Topic: [Share] How to show Number of Entries Using will_paginate Gem
As Ruby On Rails developer, we have to interact and use so many gems. One of the most used gem is will_paginate to display pagination in our application view. But, is it possible to display number of entries using this gem? The answer is possible and the good news is you don't have to customize anything. Just called its helper and done. Which helper ?
To display number of entries currently displayed on your view which contain pagination using will_paginate gem, you just have to include the following helper into your application view.
<%= page_entries_info @posts if @posts.present? %>
Don't forget to replace @posts with your own variable. Why do I include @posts.present? ? Well it's just for error handler, to handle if @posts is nil. Again, don't forget to replace @posts with your own variable.