开发者

will_paginate and named_routes

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜