Help | Site Map
Connecting Tech Pros Worldwide
Reply
 
LinkBack Thread Tools
  #1  
Old July 7th, 2008, 11:23 AM
Newbie
 
Join Date: Oct 2007
Posts: 9
Default Pagination in Ruby on Rails

Hello,
I have generated ruby reports for my application.For html display of report,i have to use next,previous links for navigation.I need to have 10 records per page.And when click on next link,i should be able to retrieve the next 10 records.For retreiving records, i have used find_by_sql query.By this i can limit the records,but displaying other records in next page,i am not able to do.
How can i do this.Please help me.Its urgent.

Thanks in advance
Reply
  #2  
Old July 7th, 2008, 07:17 PM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 12,596
Default

Take a look at the will_paginate gem/plugin.
Reply
  #3  
Old July 8th, 2008, 04:08 PM
Expert
 
Join Date: May 2007
Posts: 177
Default

Rails did have built in pagination, which would work, but it was deprecated in Rails 2.0. Otherwise, you will probably want to use the will_paginate plugin mentioned above or write pagination by hand using variables to track your current location in the records. Might just depend how complicated or elegant you want it.
Reply
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles