开发者

will_paginate and named_routes

开发者 https://www.devze.com 2023-01-16 13:57 出处:网络
I have some problems using will_paginate and named routes. Here is some code (my site is in Spanish language):

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

精彩评论

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