# How to paginate a table using a relation with other table

**URL:** <https://www.ruby-forum.com/t/how-to-paginate-a-table-using-a-relation-with-other-table/90329>\
**Category:** Rails\
**Created:** [March 27, 2007, 9:40pm UTC](https://www.ruby-forum.com/t/how-to-paginate-a-table-using-a-relation-with-other-table/90329 "2007-03-27T21:40:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [March 27, 2007, 9:40pm UTC](https://www.ruby-forum.com/t/how-to-paginate-a-table-using-a-relation-with-other-table/90329/1 "2007-03-27T21:40:51Z")

</div>

Hello,

I have this model

Item  
has\_many :tasks

Task  
belongs\_to :item

```
I have a filter

```

@task\_pages, @tasks =paginate :tasks, :per\_page =\> 10, :conditions  
=\> ["company\_id = ?’, company\_id]

```
How can I use a set of Items to return some records in Tasks, and

```

use it in Paginate?

```
 Item.find (:all, :conditions => ['model = ?','KJ-393'])

 and paginate just the tasks thar belongs to this Items?

```

Thank you
