Alexey Zakharov
Alexey Zakharov

Reputation: 25102

Scoped match routes in Rails

Is it possible to set scope for match routings.

I have tried this:

scope "/admin" do 
  match ':controller/:action/:id' 
emd

But it doesn't work.

Upvotes: 1

Views: 848

Answers (1)

Yannis
Yannis

Reputation: 5426

Should be something like:

scope "/admin" do 
  match ':controller/:action/:id', :to => 'home#index', :via => 'get'
end

You have to match something TO something else… The :via method definition isn't mandatory.

EDIT

You may also try

scope "/admin" do 
  match '/:controller(/:action(/:id))' 
end

Upvotes: 2

Related Questions