DiegoZamora
DiegoZamora

Reputation: 13

Prefix route with a named parameter

I have a match that render by a named parameter

match '/:username' => 'controller#action'

I also have some resourses in my "/"

resourses :products, :services

The problem is when I want to go to products the routing take 'product' as :username parameter. How can I fix this?

Upvotes: 1

Views: 327

Answers (1)

apneadiving
apneadiving

Reputation: 115531

Look here, you could do:

scope "(:username)/" do
  resources :products
end

Upvotes: 2

Related Questions