I have some problems using will_paginate
and named routes.
Here is some code (my site is in Spanish language):
routes.rb
map.animals '/animales/:scope/:id', :controller => :categories, :action => :show
wi开发者_JAVA百科th these routes I generate URLs like:
www.domain.com/animales/mamiferos/perros
but, when pages links are generated I get links like:
www.domain.com/animals/perros?page=2&scope=mamiferos
Why are they like that?
NOTE: I am also using friendly_id
.
You need to make sure that there is no matching route before the animals route in the routes.rb file. E.g. the default route map.connect ":controller/:action/:id" and the resource definition map.resources :animals should come after the named animals route.
精彩评论