to avoid repeated pagination code

Sijo Kg
Tue, 25 Mar 2008 04:43:30 -0000

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
--
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---