Skip to content

Instantly share code, notes, and snippets.

@diebels727
Created December 30, 2010 20:12
Show Gist options
  • Save diebels727/760229 to your computer and use it in GitHub Desktop.
Save diebels727/760229 to your computer and use it in GitHub Desktop.
def index
#...
current_page = (params[:page] || 1) # <--- I probably should just 'to_i' both current_page and per_page
per_page = (params[:per_page] || 25) # <---
#...
@reports = WillPaginate::Collection.create(current_page, per_page, @results.count) do |pager|
start = (current_page.to_i-1)*per_page # <---- the problem was here. current_page can be a String.
pager.replace( @results[start, per_page] )
end
#...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment