Paginating a fetched resultset problems with next/previous

Im using this paginate function to paginate complex sql queries
BigBold - Informasi Tentang Bisnis dan Marketing, all seems to work fine
but theres one thing, when i hit the next link it show nothing, i mean
it only shows the first page, here is the code im using:


def paginate_collection(collection, options = {})
default_options = {:per_page => 10, :page => 1}
options = default_options.merge options

pages = self, collection.size, options[:per_page], 

first = pages.current.offset
last = [first + options[:per_page], collection.size].min
slice = collection[first…last]
return [pages, slice]


@paginas, @entradas = paginate_collection Entrada.find(:all,
:conditions => [‘month(creado_en) = ?’, params[:mes]],
:order => ‘id desc’), :page => @params[:page]


<%= link_to ‘Previous page’, { :page => @paginas.current.previous } if
@paginas.current.previous %>
<%= link_to ‘Next page’, { :page => } if %>

I think its something whit the pagination links but i cant make it to
work, so any help rubists :wink: