Permalink
Browse files

Data Mapper: fix stack overflow

  • Loading branch information...
1 parent 01dd16c commit 0bb3c8da9c15910124e8ce446195262fec634d76 @pnomolos pnomolos committed with Dec 28, 2011
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/will_paginate/data_mapper.rb
@@ -51,7 +51,9 @@ def total_entries
if loaded? and @array.size < per_page and (current_page == 1 or @array.size > 0)
offset + @array.size
else
- clean_query = query.merge(:order => [])
+ # :reload prevents Collection.filter from being run, which
+ # would cause a stack overflow
+ clean_query = query.merge(:reload => true)
# seems like the only way
clean_query.instance_variable_set('@limit', nil)
clean_query.instance_variable_set('@offset', 0)

0 comments on commit 0bb3c8d

Please sign in to comment.