Pagination

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…

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


DynamicDudes

Lightweight Ruby on Rails application development
http://dynamicdudes.com
http://rubyphunk.com

On Mon, Oct 20, 2008 at 3:14 PM, Tiago P.

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
resource?

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
/journals/:id/entries?page=2

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)