change the URL without changing the resource name
22,286
have you tried this, should work
resources :rabbit_categories, :path => "rabbits/categories"
See Rails Routing from Outside In for more details.
Comments
-
declan almost 2 years
I'm building a website for a rabbit farmer (let's pretend). This man keeps a close eye on his rabbits, and wants them all categorized. So I built him a RabbitCategoriesController, and added this line to my routes.rb
resources :rabbit_categories
The URLs are showing up as
rabbit_categories
,rabbit_categoriew/new
, etc.What if I want the URLs to look like
rabits/categories
rabits/categories/new
instead? This is not a nested resource, I just want to change the way the URLs look.Of course, if the resources were called "categories", I could do
namespace :rabbits do resources :categories end
Is there any way I can write that, but tell it to use the RabbitCategoriesController instead of the Rabbits::CategoriesController?