to avoid repeated pagination code

Hi
   Below is the code for controller service_desk show action(some
portion only)
  def show
        @sd_attachments=service_desk_ticket.service_desk_attachments.paginate
:page => params[:page], :per_page => 15
   @sd_activities=ServiceDeskActivity.find_all_by_service_desk_ticket_id(service_desk_ticket.id)paginate
:page => params[:page], :per_page => 15

   end

    HERE THE show.rhtml contains differnt tabs like
Attachments,Activities etc..
And I use Ajax for pagination in all these tabs..Suppose for example
sd_attachments first show say 15 attachments, then to get next 15, I
again have to write the same pagination code as in show for this
sd_attachments in the controller...(In another file)And by using RJS
replacing the div (The sd_attachment is complete inside a div)...BUT THE
PROBLEM IS EVEN IF THE CODE FOR PAGINATION IS THERE IN show ACTION I
HAVE TO WRITE IT AGAIN AND AGAIN FOR EACH TAB...HOW CAN I AVOID THIS.?

Sijo