Permalink
Browse files

Assuring that the input paremeters ':offset' and ':page' are Fixnums,…

… this way we won't have problems with number compare
  • Loading branch information...
1 parent ba46131 commit 3dddd686839d7064642b740d99b14adf5f9bc35c @roman committed Oct 1, 2009
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/walruz/more/pagination/base.rb
@@ -7,8 +7,12 @@ module Base
def authorized_paginate(actor, action, *args)
# All the args are forwarded to WillPaginate, he knows best what to do
options = args.last if Hash === args.last
+
options[:page] ||= 1
- offset = options.delete(:offset) || 0
+ options[:page] = options[:page].to_i
+
+ offset = options.delete(:offset).to_i # defaults to 0
+
acum = []
while true
paginated_collection = self.paginate(*args)

0 comments on commit 3dddd68

Please sign in to comment.