views:

556

answers:

1

I want to create a route in my rails application along the lines of

/panda/blog
/tiger/blog
/dog/blog

where panda, tiger, and dog are all permalinks (for an animal class)

The normal way of doing this

map.resources :animals do |animal|
 animal.resource :blog
end

would create routes along the lines of

/animals/panda/blog
/animals/tiger/blog
/animals/dog/blog

But i do not want the first segment, as it will always be the same.

I know I could do this by manual routing, but I want to know how to do using rails resources, as having animals and blogs is a requirement for me.

+1  A: 

You can use this plugin:

http://github.com/caring/default_routing/tree/master

Bartosz Blimke