Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 DataMapper - Pagination
Index -> Programming, Ruby -> Ruby Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
DtY




PostPosted: 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:
SQL:
SELECT ... LIMIT a, b

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.
Sponsor
Sponsor
Sponsor
sponsor
DtY




PostPosted: 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.
Display posts from previous:   
   Index -> Programming, Ruby -> Ruby Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: