# How can I paginate records find by using find\_by\_sql

**URL:** <https://www.ruby-forum.com/t/how-can-i-paginate-records-find-by-using-find-by-sql/172568>\
**Category:** Rails\
**Created:** [July 23, 2009, 1:20pm UTC](https://www.ruby-forum.com/t/how-can-i-paginate-records-find-by-using-find-by-sql/172568 "2009-07-23T13:20:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![indu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/eada6e/32.png) [@indu](https://www.ruby-forum.com/u/indu)\
**Post date:** [July 23, 2009, 1:20pm UTC](https://www.ruby-forum.com/t/how-can-i-paginate-records-find-by-using-find-by-sql/172568/1 "2009-07-23T13:20:57Z")

</div>

Hello everyone,

I forced to use @user = User.find\_by\_sql sql\_query in a particular  
situation in my project. Now I want to paginate the records. How can I  
paginate the records?  
Please help me.

Thanks in advance

---

<div class="post-metadata">

**Author:** ![indu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/eada6e/32.png) [@indu](https://www.ruby-forum.com/u/indu)\
**Post date:** [July 23, 2009, 1:59pm UTC](https://www.ruby-forum.com/t/how-can-i-paginate-records-find-by-using-find-by-sql/172568/2 "2009-07-23T13:59:47Z")

</div>

On 23 Jul 2009, at 12:20, Indu RS wrote:

> Hello everyone,
> 
> I forced to use @user = User.find\_by\_sql sql\_query in a particular  
> situation in my project. Now I want to paginate the records. How can I  
> paginate the records?

will\_paginate etc. can help you with the view helpers on stuff but it  
will be up to you to modify the sql you generate to get the correct  
range of records.

Fred
