# Pagination for Partial with page.replace\_html

**URL:** <https://www.ruby-forum.com/t/pagination-for-partial-with-page-replace-html/127147>\
**Category:** Rails\
**Created:** [January 25, 2008, 2:11pm UTC](https://www.ruby-forum.com/t/pagination-for-partial-with-page-replace-html/127147 "2008-01-25T14:11:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mark](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@mark](https://www.ruby-forum.com/u/mark)\
**Post date:** [January 25, 2008, 2:11pm UTC](https://www.ruby-forum.com/t/pagination-for-partial-with-page-replace-html/127147/1 "2008-01-25T14:11:27Z")

</div>

I have a partial which has a list of jobs in it.

I want to perform an action “save and go to next” which may or may not  
take me to a new record which is on a different page of the partial.

def updatenext  
@job = Job.find params[:id]  
if @job.update\_attributes params[:job]  
generate\_paginated\_list  
nextid = getnextid(@job.id)  
render :update do |page|  
@job = Job.find\_by\_id(nextid) #we want to show the next here  
page.replace\_html ‘jobs-list’, :partial =\> ‘list’ # This  
line does not do what I need it to do  
page.replace\_html ‘job-detail-section’, :partial =\> ‘edit’  
end  
else  
render :update do |page|  
page.replace\_html ‘job-detail-section’, :partial =\> ‘edit’  
end  
end  
end

def generate\_paginated\_list

```
@job_pages, @jobs = paginate :jobs, :order_by => 'created_at

```

desc’, :per\_page =\> 15  
end

How do I make it such that @job\_pages can be set to a different page  
when the replace partial is called?

I want to look up what page the @job.id is contained within and  
replace\_html ‘jobs-list’ with that page.

Thanks
