R
R
Robert2015-03-13 20:47:05
Ruby on Rails
Robert, 2015-03-13 20:47:05

How to properly organize routes in Rails?

.....  
  get '/:email', to: 'current_user#show', as: 'current_user'
  get '/:email/admin', to: 'admins#index', as: 'admin'

  root 'items#index' 
.....

Returns: No route matches [GET] "/here is my email/admin"
Why is this happening?
Or am I not doing it at all logically?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vsuhachev, 2015-03-14
@Jowan

The leading slash is not needed and remove the email route descriptions at the end of the file. The order of the route definitions matters, the closer to the top of the file the higher the priority, i.e. more particular cases should be higher than general ones.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question