# Pagination

**URL:** <https://www.ruby-forum.com/t/pagination/110743>\
**Category:** Rails\
**Created:** [July 30, 2007, 3:31pm UTC](https://www.ruby-forum.com/t/pagination/110743 "2007-07-30T15:31:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [July 30, 2007, 3:31pm UTC](https://www.ruby-forum.com/t/pagination/110743/1 "2007-07-30T15:31:47Z")

</div>

When using the pagination class, you can specify the :include  
parameter. Is it possible to specify two for a table that references  
two relations? For example a POST has both a USER and an  
ORGANIZATION. Would the correct syntax be:

```
  @posts_pages, @posts = paginate(:posts,
    :include => :user,
                            :include => :organizations,
    :order => 'published_at DESC',
    :conditions => "organization_id=#{params[:organization_id].to_i}

```

AND published = true")

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [July 30, 2007, 3:35pm UTC](https://www.ruby-forum.com/t/pagination/110743/2 "2007-07-30T15:35:48Z")

</div>

removed\_email\_address@domain.invalid wrote:

> AND published = true")  
> According to the API docs, paginate will pass the include options onto  
> #find which in turn would expect an array, so:

:include =\> [:user, :organisation]

is the way to do it.

–  
Cheers,

- Jacob A.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [July 30, 2007, 3:43pm UTC](https://www.ruby-forum.com/t/pagination/110743/3 "2007-07-30T15:43:49Z")

</div>

Many Thanks
