Permalink
Browse files

Fix bug where page info display does not fetch count correctly when u…

…sing a group by clause
  • Loading branch information...
Brad Seefeld
Brad Seefeld committed Dec 2, 2011
1 parent d56a843 commit a66a1a4d91078af4a912490a0883150a64d3f9bc
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/will_paginate/view_helpers.rb
@@ -136,8 +136,10 @@ def page_entries_info(collection, options = {})
if collection.total_pages < 2
i18n_key = :"page_entries_info.single_page#{html_key}"
keys = [:"#{model_key}.#{i18n_key}", i18n_key]
-
- will_paginate_translate keys, :count => collection.size, :model => model_name do |_, opts|
+
+ count = collection.size
+ count = count.length if count.is_a? Hash
+ will_paginate_translate keys, :count => count, :model => model_name do |_, opts|
case opts[:count]
when 0; "No #{opts[:model]} found"
when 1; "Displaying #{b}1#{eb} #{opts[:model]}"

0 comments on commit a66a1a4

Please sign in to comment.