Forum: Ruby on Rails Pagination

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Df0f5baf4ea3eecca53d77814879208a?d=identicon&s=25 Tiago Pinto (tipsantos)
on 2008-10-20 15:14
Hello all..
I'm new in Ruby on Rails. I'm doing an application which needs to use
pagination. This is ok. I got to use it and I didn't find any error. But
I've got to put a city names "research" too. That's the problem. The
pagination failed. the variable doesn't take its value. Below it's my
city's list:

Aracaju    Editar  Excluir
Borborema   Editar   Excluir
Brasília   Editar   Excluir
Campinas   Editar   Excluir
Campo Largo   Editar   Excluir
Curitiba   Editar   Excluir
Curralinho   Editar   Excluir
Diadema   Editar   Excluir
Florianópolis   Editar   Excluir
Fortaleza   Editar   Excluir

I want to look for all cities with letter "a". My code find them. But
when I try to go to 2nd page, there is an error:

You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]

My variable doesn't take the "research". Does anybody know what I can do
about that? Thanks a lot..
7b5c142a67af70ddc5cf696d952b2a81?d=identicon&s=25 Andreas Wolff (Guest)
on 2008-10-20 15:29
(Received via mailing list)
I'm not sure what you mean, but if you need to include the "research"
variable in your form (eg. for page 2) you can use a hidden field for
that purpose..

lg // andreas


Lightweight Ruby on Rails application development

On Mon, Oct 20, 2008 at 3:14 PM, Tiago Pinto
Df0f5baf4ea3eecca53d77814879208a?d=identicon&s=25 Tiago Pinto (tipsantos)
on 2008-10-20 15:33
Ok, thanks a lot.. I'll try that. Just to know, my problem is like
described below:

How would I redirect a will_paginate link to a different, nested

For example, on the entries page I am paginating entries and it works
just fine.  On the home page, I am also paginating entries, but only the
first 10 results.  If you click next, I would like the user to be sent
to page 2 of the entries page.

The following does not work, as I am trying to go to

Code :   - fold - unfold

   1. :params => { :controller => "journal", :action => "index" }

It instead leads to /entries/index/3?page=2.  Basically, I am trying to
send it:

Code :   - fold - unfold

   1. :url => journal_entries_path(@journal)
This topic is locked and can not be replied to.