Hi Till now we used the rails pagination.But now onwards shifting to will_paginate The code I use currently is as below .This is with the help of find_where pluggin..A fantastic pluggin which we still want to use...I would like to know how can i modify the following code to work with will_paginate step 1: set the variables you''ll need page = (params[:page] ||= 1).to_i items_per_page = 20 offset = (page - 1) * items_per_page # step 2: instead of performing the full find, just find the record count @search_sd_ticket_count_result ServiceDeskTicket.find_where(:all,:select=>''count(*) as count1'' ) do |sd| sd.number.downcase =~ "%"+@sd_ticket_number.downcase+"%" if !@sd_ticket_number.nil? sd.service_desk_status_id=@sd_ticket_status_id sd.service_desk_priority_id=@sd_ticket_priority_id sd.primary_assignee=@sd_ticket_primary_assignee sd.created_on <=> (@sd_ticket_start_date..@sd_ticket_end_date) if !@sd_ticket_start_date==nil and !@sd_ticket_end_date==nil end record_count=@search_sd_ticket_count_result[0].count1.to_i # step 3: create a Paginator, the second variable has to be the number of ALL items on all pages @search_sd_ticket_result_pages = Paginator.new(self, record_count, items_per_page, page) # step 4: only find the requested subset of @search_sd_ticket_result # @search_sd_ticket_result ServiceDeskTicket.find_where(:all,:offset=>offset,:limit=>items_per_page ) do |sd| sd.number.downcase =~ "%"+@sd_ticket_number.downcase+"%" if !@sd_ticket_number.nil? sd.service_desk_status_id=@sd_ticket_status_id sd.service_desk_priority_id=@sd_ticket_priority_id sd.primary_assignee=@sd_ticket_primary_assignee sd.created_on <=> (@sd_ticket_start_date..@sd_ticket_end_date) if !@sd_ticket_start_date==nil and !@sd_ticket_end_date==nil end I could do will_paginate with imple cases like @sd_attachments=@sd_ticket.sd_attchments.paginate :per_page=>20,:page=>params[:page] and in view <%= will_paginate %> .But how can I convert the above to use will_paginate Thanks in advance 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 -~----------~----~----~----~------~----~------~--~---