How to paginate a table using a relation with other table


#1

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