Computer Science Canada
DataMapper - Pagination
|Author:||DtY [ Sat Jul 11, 2009 1:37 pm ]|
|Post subject:||DataMapper - Pagination|
All right, another DataMapper question. I'm working on pagination. I can limit the results with .all(:limit=>limit), but I can't figure out how to set a starting point.
What is needs to do is replicate an SQL query something like this:
Where I can set a and b. b would be what is going into :limit, so I need some way to change a.
I looked at the documentation, and tried reading the source, but found nothing useful. I also tried passing a range and array to :limit.
|Author:||DtY [ Sat Jul 11, 2009 7:43 pm ]|
|Post subject:||RE:DataMapper - Pagination|
Solved, you use the :offset property. There's also a plugin for it, but that feels like overkill for something so simple.