Deekor
Deekor

Reputation: 9499

catch all route for a specific controller

I want to write a catch all route for my Admin controller so I don't have to define a lot of routes.

I was thinking something like this would work:

match "/admin(/:action)(/:id)"

but obviously not.

Whats the best way to go about this? I only want this for the Admin controller nothing else.

Upvotes: 1

Views: 181

Answers (1)

MrYoshiji
MrYoshiji

Reputation: 54882

I think this one will work for you:

match "/admin(/:action)(/:id)", controller: 'admin' 

But I am not sure on how it will behaves for the path "/admin" (no params[:action]).

Upvotes: 1

Related Questions