Pagination

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")

[email protected] 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.

Many Thanks