2009/11/30 Jason Rogers <[email protected]>

> You don't have to use will_paginate with Sequel. You can include the
> Sequel::Dataset::Pagination module:
>
>  Sequel.extension :paginate
>
> which adds the methods #paginate and #each_page to Dataset instances.
>
>  paginated = dataset.paginate(1, 10) # page 1, 10 rows per page
>  paginated.page_count #=> number of pages in dataset
>  paginated.current_page #=> 1
>  paginated.next_page #=> next page number or nil
>  paginated.prev_page #=> previous page number or nil
>  paginated.first_page? #=> true if page number = 1
>  paginated.last_page? #=> true if page number = page_count
>
> Of course, that's only at the database layer. You then have to keep
> track of pages in your services or UI.
>
> --
> Jason
>
> On Sun, Nov 29, 2009 at 6:18 PM, Christer Nilsson
> <[email protected]> wrote:
> > I realise pagination is not that easy.
> >>
> >>
> >> I'm using Sinatra and Sequel and would like to find some sample code.
> >> I tried will_paginate, but it seems to load the full set, which means 8
> >> secs instead of 0.1 sec in my case.
> >>
> >> Is Sequel::Dataset::Pagination involved in will_paginate or an
> alternative
> >> method?
> >>
> >> As I understand is the state transferred completely in the pagination
> >> links, for both page viewing and column sorting.
> >>
> >> Is will_paginate only compatible with ActiveRecords ?
> >>
> >> /Christer
> >>
> > I found a solution to my problem:
> >
> >
> http://www.pathf.com/blogs/2008/06/how-to-use-will_paginate-with-non-activerecord-collectionarray/
> >
> > Christer
> >
> > --
> >
> > You received this message because you are subscribed to the Google Groups
> > "sinatrarb" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<sinatrarb%[email protected]>
> .
> > For more options, visit this group at
> > http://groups.google.com/group/sinatrarb?hl=en.
> >
>
>
>
> --
> Jason Rogers
>
> "I am crucified with Christ: nevertheless I live;
> yet not I, but Christ liveth in me: and the life
> which I now live in the flesh I live by the faith of
> the Son of God, who loved me, and gave
> himself for me."
>    Galatians 2:20
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "sequel-talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<sequel-talk%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/sequel-talk?hl=en.
>
>
>

Yes, but it is nice to be able to call
   =will_paginate(@issues)
in the UI and get all the page links.
Christer

--

You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.


Reply via email to