I searched in Internet (http://wiki.github.com/mislav/will_paginate/ simple-search and http://railscasts.com/episodes/51), but I can't solve my problem about pagination. The first page is ok, but when I click the “Next page” or any other page link, I lose the FIELD1, FIELD2, FIELD3 parameter(s). Can you help me? Thank you very much.
class Model < ActiveRecord::Base ... def self.display(cond, par, page) paginate :all, :include => [:table1, :table2], :conditions => [cond, par].flatten, :page => page, :per_page => 10 end end -------- class ModelController < ApplicationController def start ... end ... def view condition = "1=1" param = [] (condition+=" AND models.FIELD1=?"; param << params [:FIELD1].values) if params[:FIELD1] (condition+=" AND models.FIELD2=?"; param << params [:FIELD2].values) if params[:FIELD2] (condition+=" AND models.FIELD3=?"; param << params [:FIELD3].values) if params[:FIELD3] @items = Model.display(condition, param, params[:page]) end end -------- view.html.erb ... <%= will_paginate @items %> -------- start.html.erb ... <% form_tag(:action => "view", :method => "get") do %> ... # define FIELD1, FIELD2 and FIELD3 <% end %> --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---