mislav-will_paginate(will_paginate) doesn't work after search.

servers_controller.rb
  def index
    @servers = Server.paginate(:page => params[:page], :per_page => 20,
:order => 'device_id ASC')
    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @servers }
    end
  end

   def search
       @servers = Server.paginate(:page => params[:page], :per_page =>
20, :order => 'device_id ASC', :conditions => ["hostname like ?",
"%"+params[:keyword]+"%"])
       render :action => 'index'
   end

index.html.erb
<%= will_paginate @servers %>

paginate works fine for index, but after search, only first page is
showed,
when I click "next" or "2", the error appears.
ActiveRecord::RecordNotFound (Couldn't find Server with ID=search):
  app/controllers/servers_controller.rb:26:in `show'

It seems like paginate doesn't know, params[:keyword],
I haven't done anything for "def show" in servers_controller.rb.

  def show
    @server = Server.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @server }
    end
  end

How can I resolve this issue?

-duke
-- 
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@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
-~----------~----~----~----~------~----~------~--~---

Reply via email to