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