Nate Wiger wrote:
> This should be easy, and for some reason I'm missing something.
>
> class User< Sequel::Model
> end
>
> Then:
>
> User.paginate(1,10)
>
> I get:
>
> undefined method `paginate' for #<Sequel::MySQL::Dataset: "SELECT
> * FROM `users`">
>
> So I figured, maybe I need to load a plugin. I looked here:
>
> http://sequel.rubyforge.org/plugins.html
>
> And "pagination" is listed as an extension, so I tried this:
>
> irb(main):002:0> Sequel::Model.plugin :pagination
> LoadError: no such file to load -- sequel_pagination
>
Hey Nate.
The pagination is a sequel extention, you can load it like this:
Sequel.extension(:pagination)
page = (params[:page] || 1).to_i
@journeys =
@vehicle.journeys_dataset.order(:start_timestamp.asc).paginate(page, 20)
I also like the load the extension 'blank':
<% if [email protected]? %>
<% if @journeys.respond_to?(:current_page) %>
// pagination links
<% end %>
// display results
<% end %>
HTH
Luke
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---