Skip to content

Commit

Permalink
put back in handling for ruby 1.8.7 with empty count options
Browse files Browse the repository at this point in the history
  • Loading branch information
graysky committed Oct 17, 2008
1 parent b2ae91e commit dd8590b
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/will_paginate/finder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,18 @@ def wp_count(options, args, finder)
end

# we may have to scope ...
counter = Proc.new { count(count_options) }
counter = Proc.new do
# MGC: Edit to workaround #424 pagination issue
# calling count with empty {} returns 0 for stream entries
c = 0
if count_options.empty?
c = count()
else
count(count_options)
end

c
end

count = if finder.index('find_') == 0 and klass.respond_to?(scoper = finder.sub('find', 'with'))
# scope_out adds a 'with_finder' method which acts like with_scope, if it's present
Expand Down

0 comments on commit dd8590b

Please sign in to comment.