Permalink
Browse files

Fixed issue with calling empty? on a relation with a group clause

  • Loading branch information...
1 parent e1f4af7 commit 641e7d1fc005a163683dfc58da893e3aa1a1833f @phene committed Sep 8, 2011
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/will_paginate/active_record.rb
@@ -81,7 +81,11 @@ def size
# overloaded to be pagination-aware
def empty?
if !loaded? and offset_value
- count <= offset_value
+ if rel_count.respond_to?(:size) and !rel_count.is_a?(Integer)
+ rel_count.size <= offset_value
+ else
+ rel_count <= offset_value
+ end
else
super
end

0 comments on commit 641e7d1

Please sign in to comment.