Sortable list search

Hi I think I have a simple problem, but I just can’t find the solution
I just found a very simple sorting solution in a book something like
that
It works in the first page with localhost/faculdade?sort_by=name
but when u try to go to the next page it goes to
http://localhost:3000/faculdade?page=2 I know it should be
/page=2&sort_by=name but don’t know how to do it …
Thanks in advance !

#on list.rhtml

<%= link_to ‘Next page’, { :page => @faculdade_pages.current.next } if
@faculdade_pages.current.next %>

and on the controller
def list
sort_by = params[:sort_by]
@_pages, @faculdades = paginate :faculdades, :order => sort_by,
:per_page => 20

Name

This should do the job.
<%= link_to ‘Next page’, { :page =>
@faculdade_pages.current.next, :sort_by => params[:sort_by] } if
@faculdade_pages.current.next %>

On Apr 1, 12:39 pm, Adriano L. [email protected]

Richard L. wrote:

This should do the job.
<%= link_to ‘Next page’, { :page =>
@faculdade_pages.current.next, :sort_by => params[:sort_by] } if
@faculdade_pages.current.next %>

On Apr 1, 12:39 pm, Adriano L. [email protected]

problem solved, hopes it helps someone …

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs