Pagination for Partial with page.replace_html

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